|
uname -a
|
Show system and kernel
|
|
head -n1 /etc/issue
|
Show distribution
|
|
mount
|
Show mounted filesystems
|
|
date
|
Show system date
|
|
uptime
|
Show uptime
|
|
whoami
|
Show your username
|
|
man command
|
Show manual for command
|
|
df -h
|
Show free space disk
|
|
df
|
Size files
|
|
du
|
Size files
|
|
CTRL-z
|
Sleep program
|
|
CTRL-a
|
Go to start of line
|
|
CTRL-e
|
Go to end of line
|
|
CTRL-u
|
Cut from start of line
|
|
CTRL-k
|
Cut to end of line
|
|
alt-left/right
|
Move next work
|
|
!!
|
Repeat last command
|
|
!abc
|
Run last command starting with abc
|
|
!$
|
Last argument of previous command
|
|
ALT-.
|
Last argument of previous command
|
|
!*
|
All arguments of previous command
|
|
^abc^123
|
Run previous command, replacing abc with 123
|
|
env
|
Show environment variables
|
|
echo $NAME
|
Output value of $NAME variable
|
|
export NAME=value
|
Set $NAME to value
|
|
$PATH
|
Executable search path
|
|
$HOME
|
Home directory
|
|
$SHELL
|
Current shell
|
|
cmd < file
|
Input of cmd from file
|
|
cmd1 <(cmd2)
|
Output of cmd2 as file input to cmd1
|
|
cmd > file
|
Standard output (stdout) of cmd to file
|
|
cmd > /dev/null
|
Discard stdout of cmd
|
|
cmd >> file
|
Append stdout to file
|
|
cmd 2> file
|
Error output (stderr) of cmd to file
|
|
cmd 1>&2
|
stdout to same place as stderr
|
|
cmd 2>&1
|
stderr to same place as stdout
|
|
cmd &> file
|
Every output of cmd to file
|
|
cmd1 | cmd2
|
stdout of cmd1 to cmd2
|
|
cmd1 |& cmd2
|
stderr of cmd1 to cmd2
|
|
cmd1 ; cmd2
|
Run cmd1 then cmd2
|
|
cmd1 && cmd2
|
Run cmd2 if cmd1 is successful
|
|
cmd1 || cmd2
|
Run cmd2 if cmd1 is not successful
|
|
-a
|
Show all (including hidden)
|
|
-R
|
Recursive list
|
|
-r
|
Reverse order
|
|
-t
|
Sort by last modified
|
|
-S
|
Sort by file size
|
|
-l
|
Long listing format
|
|
-1
|
One file per line
|
|
-m
|
Comma-separated output
|
|
-Q
|
Quoted output
|
|
grep pattern files
|
Search for pattern in files
|
|
grep -i
|
Case insensitive search
|
|
grep -r
|
Recursive search
|
|
grep -v
|
Inverted search
|
|
grep -o
|
Show matched part of file only
|
|
find /dir/ -name name*
|
Find files starting with name in dir
|
|
find /dir/ -user name
|
Find files owned by name in dir
|
|
find /dir/ -mmin num
|
Find files modifed less than num minutes ago in dir
|
|
whereis command
|
Find binary / source / manual for command
|
|
locate file
|
Find file (quick search of system index)
|
|
touch file1
|
Create file1
|
|
cat file1 file2
|
Concatenate files and output
|
|
less file1
|
View and paginate file1
|
|
file file1
|
Get type of file1
|
|
head file1
|
Show first 10 lines of file1
|
|
tail file1
|
Show last 10 lines of file1
|
|
tail -F file1
|
Output last lines of file1 as it changes
|
|
watch -n 5 'nt -p'
|
Issue the 'ntpq -p' command every 5 seconds and display output
|
|
ps
|
Show snapshot of processes
|
|
top
|
Show real time processes
|
|
kill pid
|
Kill process with id pid
|
|
pkill name
|
Kill process with name name
|
|
killall name
|
Kill all processes with names beginning name
|
|
chmod 775 file
|
Change mode of file to 775
|
|
chmod -R 600 folder
|
Recursively chmod folder to 600
|
|
chown user:group file
|
Change file owner to user and group to group
|
|
First digit is owner permission, second is group and third is everyone.
|
|
|
4
|
read (r)
|
|
2
|
write (w)
|
|
1
|
execute (x)
|
|
tar -cvf a.tar /dir
|
Create a tar archive called a.tar for dir
|
|
tar cvzf a.tar.gz /dir
|
gzip compressed archive
|
|
tar -xvf Archive.tar.gz
|
Uncompress
|
|
v
|
show the progress of archive file
|
|
c
|
create a archive file.
|
|
x
|
extract a archive file.
|
|
f
|
filename of archive file
|
|
t
|
viewing content of archive file.
|
|
j
|
filter archive through bzip2.
|
|
z
|
filter archive through gzip
|
|
r
|
append or update files
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.