-
Notifications
You must be signed in to change notification settings - Fork 0
Cheatsheet Unix
Agustí Sánchez edited this page Aug 17, 2020
·
13 revisions
lsof -i -n -P | grep java
Solaris
pfiles `ls /proc` 2>/dev/null | awk "/^[^ \\t]/{smatch=\$0;next}/port:[ \\t]*${1}/{print smatch, \$0}{next}"
find . -name "*.txt" | xargs dos2unix
du
df
free
Filesystem a directory is mounted on:
df <dir>
sudo lshw -html > hardware.html
xdg-open
f [ ! -e "$file" ]; then
echo "File does not exist"
else
echo "File exists"
fi
```
```
-b filename - Block special file
-c filename - Special character file
-d directoryname - Check for directory existence
-e filename - Check for file existence, regardless of type (node, directory, socket, etc.)
-f filename - Check for regular file existence not a directory
-G filename - Check if file exists and is owned by effective group ID.
-g filename - true if file exists and is set-group-id.
-k filename - Sticky bit
-L filename - Symbolic link
-O filename - True if file exists and is owned by the effective user id.
-r filename - Check if file is a readable
-S filename - Check if file is socket
-s filename - Check if file is nonzero size
-u filename - Check if file set-user-id bit is set
-w filename - Check if file is writable
-x filename - Check if file is executable
#!/bin/bash
for i in {1..5}
do
echo "Welcome $i times"
done
-o StrictHostKeyChecking=no
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 30G 0 part /