Professional Documents
Culture Documents
uname -a Show system and kernel pwd Show current directory Files
head -n1 /etc/issue Show distribution mkdir dir Make directory dir Ctrl-R Read file
mount Show mounted filesystems cd dir Change directory to dir Ctrl-O Save file
find /dir/ -name Find files starting with name in dir screen -r
Bash Variables name* Resume a screen session.
find /dir/ -user Find files owned by name in dir screen -list
env Show environment variables
name Show your current screen sessions.
echo $NAME Output value of $NAME
find /dir/ -mmin Find files modifed less than num CTRL-A
variable
num minutes ago in dir Activate commands for screen.
export NAME =v Set $NAME to value
whereis Find binary / source / manual for CTRL-A c
alue
command command Create a new instance of terminal.
$PATH Executable search path
locate file Find file (quick search of system CTRL-A n
$HOME Home directory
index) Go to the next instance of terminal.
$SHELL Current shell
CTRL-A p
File Operations Go to the previous instance of terminal.
IO Redirection
touch file1 CTRL-A "
cmd < file Create file1 Show current instances of terminals.
Input of cmd from file
cat file1 file2 CTRL-A A
cmd1 <(cmd2 ) Concatenate files and output Rename the current instance.
Output of cmd2 as file input to cmd1
less file1 More screen info at:
cmd > file View and paginate file1 http://www.gnu.org/software/screen/
Standard output (stdout) of cmd to file
file file1
cmd > /dev/null Get type of file1 File Permissions
Discard stdout of cmd
cp file1 file2 chmod 775 file
cmd >> file Copy file1 to file2 Change mode of file to 775
Append stdout to file
mv file1 file2 chmod -R 600 folder
cmd 2> file Move file1 to file2 Recursively chmod folder to 600
Error output (stderr) of cmd to file
rm file1 chown user :g roup file
cmd 1>&2 Delete file1 Change file owner to user and group to group
stdout to same place as stderr
head file1
cmd 2>&1 Show first 10 lines of file1 File Permission Numbers
stderr to same place as stdout
tail file1
The first digit is the owner permission, the second the
cmd &> file Show last 10 lines of file1
group and the third for everyone.
Every output of cmd to file
Every output of cmd to file
tail -f file1 Calculate each of the three permission digits by
cmd refers to a command. Output last lines of file1 as it changes adding the numeric values of the permissions below.
4 read (r)
Pipes Process Management
2 write (w)
cmd1 | cmd2 ps Show snapshot of processes
1 execute (x)
stdout of cmd1 to cmd2 top Show real time processes
cmd1 |& cmd2 kill pid Kill process with id pid
stderr of cmd1 to cmd2
pkill Kill process with name name
name
Command Lists
killall Kill all processes with names beginning
cmd1 ; cmd2 name name
Run cmd1 then cmd2
cmd1 || cmd2
Run cmd2 if cmd1 is not successful
cmd &
Run cmd in a subshell
Dave Child (DaveChild) This cheat sheet was published on 28th October, 2011 FeedbackFair, increase your conversion rate today!
cheatography.com/davechild/ and was last updated on 1st February, 2012. Try it free!
www.addedbytes.com http://www.FeedbackFair.com