Cheatography
https://cheatography.com
Useful Linux Commands for Webdevelopers
Directory / Files
cd Directoryname |
Change Directory |
ls |
List Items in Current Directory |
ls -lha |
List Items with extra Info in Current Directory |
mkdir Directoryname |
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 subdirectorys |
cp Filename (Copied Filename) |
Copy an File |
cp -R Directoryname (Copied Directoryname) |
Copy an Directory |
Backups
tar -czvf Backupname.tgz . |
Backup complete Content from Current Directory |
tar -czvf --exclude="ExcludeData" Backupname.tgz . |
Backup Content from Current Directory with Excludes |
tar -xzvf Backupname.tgz |
Extract Backup in Current Directory |
mysqldump -u User -pPassword DBName -h Host > Backupname.sql |
Backup/Export Database to Current Directory |
mysql -u User -pPassword DBName -h Host < Backupname.sql |
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 screenshare via Putty, etc. and both people can actively do something
|
|
VI / VIM Editor
vim Filename |
create/edit File |
vi Filename |
create/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 |
Important Don't use Stuff like CTRL + S this will crash Putty
Expert User Stuff
grep -rnw -e "Searchword" * |
Search in Current Directory |
scp -C ssh-username@ssh-host:/path/to/file . |
Download File over SSH from an Server |
wget url |
Download File over http/https |
alias new-commandname="Command" |
Create an Alias for the Current Session |
clear |
Clears the Terminal |
history |
Shows the History of Commands |
ctrl + r |
to search in the History |
Important If you want an Alias working every time you loging in you need to add it in the .bashrc file
Varnish Related Stuff
varnishhist |
Show a histogram chart of the last 1,000 requests |
varnishlog |
See what Varnish is currently processing |
varnishstat |
Show various information about varnish |
netstat -tulpn | grep LISTEN |
Shows you all LISTEN Ports with the Service |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets