Last active
August 29, 2015 14:09
-
-
Save eridesigns/698e91c79d57f9f23c7b to your computer and use it in GitHub Desktop.
SSH Terminal Cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//going to a desired folder | |
cd /folder/something/ | |
//back to the previews folder(directory) | |
cd .. | |
//back to the home directory | |
cd ~ | |
//shows all the folders and files | |
ls | |
//same as above just more info | |
ls -alh | |
//shows the path, where you are right now. for example /home/user/htdocs | |
pwd | |
//change permission to a file or folder | |
chmod 777 functions.php | |
Permissions guide: | |
7 = Read + Write + Execute | |
6 = Read + Write | |
5 = Read + Execute | |
4 = Read | |
3 = Write + Execute | |
2 = Write | |
1 = Execute | |
0 = All access denied | |
First number is for the owner, second for the group and third for everyone else, like viewers etc | |
//copy a file from one location to another. in the example functions.php is copied in the inc folder/directory | |
cp functions.php inc/functions.php | |
//copy a folder(including subfolders) from one location to another. The images folder has been copied in the assets folder. | |
cp -R images/ assets | |
//move or remove a file. functions.php has been moved to the inc/ directory. | |
mv functions.php inc/functions.php | |
//same with folders | |
mv inc/ lib | |
//move one folder up | |
mv inc/ .. | |
//create a empty file | |
touch index.php | |
//open a file | |
less index.php | |
//open a file using VIM | |
vi index.php | |
//Some useful VIM commands to use in the terminal. To get in the edit mode once you open the code, type i and to get out click esc. | |
:q! : Forces the editor to exit without saving. | |
:w : Saves the changes that have been made to the file. | |
:wq : Saves the changes that have been made to the file and then exits. | |
:# : Where # is a number - Brings you to line number # | |
:$ : Brings you to the last line of the file | |
:0 : Brings you to the first line of the file | |
:/word : This will search for the string "word" in the file. By pressing "n" you can view the other search result. | |
//remove - delete a file | |
rm -rf index.php | |
//same for a folder | |
rm -rf inc/ | |
//check history | |
history | |
//login to a server using SSH. Is good to setup a public key because it does not ask you for a password and it is more secure. Here is a tutorial aboout how to create a public key: http://www.eridesigns.com.au/create-ssh-public-key-mac/ | |
ssh [email protected] | |
//uploading an image from your desktop to your server | |
scp [email protected]:/home/user/apps/path/ <leave one space> /Users/You/Desktop/filename.png | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment