Show Menu

File commands

Directory listing
ls -al
Formatted listing with hidden files
ls -F
list files in current directory and indicate the file tyoe
ls -laC
list all files in current directory in long format and display in columns
cd dir
Change directory to dir
Show current directory
mkdir dir
Create a directory dir
rm file
Delete file
rm -r dir
Delecte directory dir
rm -f file
Force remove file
rm -rf dir
For remove directory dir
cp file1 file2
Copy file 1 to file2
cp -r dir1 dir2
Copy dir1 to dir2
cp file path
copy the file to the dir
mv file1 file2
Rename or move file to file2.
ln -s file link
Create symbolic link link to file
touch file
Create or update file
cat > file
Place standard input into file
more file
Output the contents of file
head file
Output the first 10 kines of file
tail file
output the last 10 lines of file
tail -f file
Output the contents of file as it grows, starting with the last 10 lines

File Permis­sions

chmod octal file
4 - read(r) 2 - write(w) 1 - execute(x)
For more options, see man chmod.


grep pattern files
search for pattern in files
grep -r pattern dir
search recurs­ively for pattern in dir
command | grep pattern
search for pattern in the output of command
locate file
find all instances of file

Process Managment

display all currently active processes
display all runing processes
kill pid
kill process id pid
killall proc
kill all processes named proc *
lists stopped or background jobs; resume a stopped job in the background
brings the most recent job to the foreground
fg a
brings job a to the foreground

System Info

show the current date and time
show this month's calendar
show current uptime
display who is online
who you are logged in as
finger user
display inform­ation about user
uname -a
show kernel inform­ation
cpu inform­ation
memory inform­ation
man command
show the manual for command
show disk usage
show direcory space usage
show memmory and swap usage
whereis app
show possible locations of app
which app
show which app will be run by default


tar cf file.tar files
create a tar named file.tar containing files
tar xf file.tar
extract the file from file.tar
tar czf file.t­ar.gz files
create a tar with Gzip compre­ssion
tar xzf file.t­ar.gz
extract a tar using Gzip
tar cjf file.t­ar.bz2
create a tar with Bzip2 compre­ssion
tar xjf file.t­ar.bz2
extract a tar using Bzip2
gzip file
compresses file and renames it to file.gz
gzip -d file.gz
decomp­resses file.gz back to file
tag flags:
c - create archive
j - bzip2 compre­ssion
t - table of contents
k - do not overwrite
x - extract
T - files from file
f - specifies filename
w - ask for confir­mation
z - use zip/gzip v - verbose


ssh user@host
connect to host as user
ssh -p port user@host
connect to host on port port as uset
ssh-co­py-id user@host
add your key to host for user to enable a keyed or passwo­rdless login


ping host
ping host and outpt result
shois domain
get whois inform­ation for domain
dig domain
get DNS inform­ation for domain
dig -x host
reverse lookup host
wget file
download file
wget -c file
continue a stopped download

Starting & Stopping

sd -h no
shutdown system now and do not reboot
stop all processes - same as above
shutdown -r 5
shutdown the system in 5 minutes and reboot
shutdown -r now
shutdown the system now and reboot
stop all processes and then reboot
start the x system


halts the current command
stops the current command, resume with fg in the foreground or bg in the background
log put of current session, similar to exit
erases one word in the current lint
erases he whole line
type to bring up a recent command
repats the last command
log ot of current session


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          mod_rewrite Cheat Sheet
          Vim NERDTree Cheat Sheet