Show Menu
Cheatography

PM Linux Command Cheat Sheet by

Useful Linux Commands for Webdevelopers

Directory / Files

cd Direct­­or­yname
Change Directory
ls
List Items in Current Directory
ls -lha
List Items with extra Info in Current Directory
mkdir Direct­­or­yname
Make Directory in Current Directory
mv Filename (new Location or Filename)
Move or Rename File or Folder
mv -R Filename (new Location or Filename)
Move or Rename File or Folder including subdir­­ec­torys
cp Filename (Copied Filename)
Copy an File
cp -R Direct­­or­yname (Copied Direct­­or­y­name)
Copy an Directory

Backups

tar -czvf Backup­­na­m­e­.tgz .
Backup complete Content from Current Directory
tar -czvf --ex­c­lu­­de=­­"­­E­­xcl­­ud­e­D­at­­a­­" Backup­­na­m­e­.tgz .
Backup Content from Current Directory with Excludes
tar -xzvf Backup­­na­m­e­.t­gz
Extract Backup in Current Directory
mysq­­ldump -u User -p­­Pa­s­sword DBName -h Host > Backup­­na­m­e­.s­ql
Backu­­p/­E­xport Database to Current Directory
mysql -u User -p­­Pa­s­sword DBName -h Host < Backup­­na­m­e­.s­ql
Import Backup from Current Directory to Database

Shared SSH Window

User1: screen -l
to start screen
User2: screen -ls
to check wich screens we have
User2: screen -x
to connect
With this technique you can work together without screen­share via Putty, etc. and both people can actively do something
 

VI / VIM Editor

vim Filename
creat­­e/edit File
vi Filename
creat­­e/edit File
In Editor Command Mode
:w
To Save the File
:q
To Close the Editor
:wq or :x
To Save and Close the Editor
? Word
To Search in the File
Press i
To switch to Insert Mode
In Editor Insert Mode
Press ESC
To exit the Insert Mode and go to Command Mode
Impo­­rt­ant Don't use Stuff like CTRL + S this will crash Putty

Expert User Stuff

grep -rnw -e "­­­S­e­ar­­chw­­or­d­­" *
Search in Current Directory
scp -C ssh-us­­er­n­a­me­­@­­­s­s­h-­­hos­­t­­­­/pa­­th­/­t­o/file .
Download File over SSH from an Server
wget url
Download File over http/h­­ttps
alias new-co­­mm­a­n­dn­­ame­­=­­"­­C­­omm­­an­d­"
Create an Alias for the Current Session
clear
Clears the Terminal
hist­­ory
Shows the History of Commands
ctrl + r
to search in the History
Impo­­rt­ant If you want an Alias working every time you loging in you need to add it in the .bas­­hrc file

Varnish Related Stuff

varn­ish­hist
Show a histogram chart of the last 1,000 requests
varn­ish­log
See what Varnish is currently proces­sing
varn­ish­stat
Show various inform­ation about varnish
netstat -tulpn | grep LISTEN
Shows you all LISTEN Ports with the Service
 

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
          Ubuntu Compose Key Combinations Cheat Sheet
          Ubuntu Unity 16.04 Keyboard Shortcuts