Show Menu

Linux command line Cheat Sheet by

linux     commandline

Directory Operations

pwd
Show current directory
mkdir <d­ir>
Make directory <d­ir>
cd <d­ir>
Change directory to <d­ir>
cd ..
Go up one directory
ls
List files

File operations

cat <f­ile­>
print the contents of <f­ile­>
cat <file1> <file2>
concat­enate <f­ile­1> and
<file2> and print the result
less <f­ile­>
view and paginate <f­ile­>
cp <file1> <file2>
copy <f­ile­1> to <f­ile­2>
mv <file1> <file2>
move <f­ile­1> to <f­ile­2>
rm <f­ile­>
delete <f­ile­>
head <f­ile­>
show the first 10 lines of
<file>
tail <f­ile­>
show the last 10 lines of
<file>
nano <f­ile­>
edit the contents of <f­ile­>

Bash shortcuts

CTRL-c
Stop current command
CTRL-a
Go to start of line
CTRL-e
Go to end of line
CTRL-r
Search history
TAB
Auto-c­omplete current command or filename
TAB TAB
Show possible completion options
Use TAB completion as much as possible, it both makes typing faster and prevents typing errors!

Important tip

Most commands which perform an operation (cp, mv, rm, touch...) do not print any output when they are succes­sful. If they do, probably there is an error.

In any case, always check the output of your commands carefully, to be sure that no error occurred.
 

Nano Shortcuts

Saving files
Ctrl-O
Save file (confirm with Y)
Ctrl-X
Close file (confirm saving with Y)
Cut and paste
ALT-A
Start marking text
CTRL-K
Cut marked text or line
CTRL-U
Paste text
Navigate file
CTRL-A
Beginning of line
CTRL-E
End of line
CTRL-C
Show line number
CTRL-_
Go to line number
Search
CTRL-W
Find text
ALT-W
Find next occurrence

Network management

ifconfig
Display current network config­uration
ifconfig <i­fac­e> up
activate interface <i­fac­e>
ifconfig <i­fac­e> down
deactivate interface <i­fac­e>
ifconfig <i­fac­e> <i­p> netmask <m­ask­>
configure interface <i­fac­e> with given <i­p> and <m­ask­>
ping <i­p>
check if <i­p> is reachable

IO Redire­¬≠ction

command < file
Input of command from file
command > file
Output of command to file
command > /dev/null
Discard output of command
command >> file
Append output of command to file

Download the Linux command line Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/alessandro-grassi_linux-command-line.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

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
          VI Editor Cheat Sheet
          Juanjux's Vim Cheatsheet Cheat Sheet