Created
February 12, 2011 05:30
-
-
Save y2kdev/823548 to your computer and use it in GitHub Desktop.
This file contains 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
ls . # files in current directory | |
ls .. # files in parent directory | |
tree > log.txt # put the results of a command in a file (You must have tree installed. It's available via macports <sudo port install tree>) | |
ls >> log.txt # append the results of a command in a file | |
mkdir -p one/two/ # create multiple directories in one step | |
env # print out environment variables in name value pair | |
Control + a # go to the beginning line | |
Control + e # go to the end line | |
Control + k # delete all to the right | |
Control + w # delete previous word | |
Control + r # search history interactively | |
Control + c # force quit out of a program i.e. vi, vim, nano etc.. | |
q,x,ctrl+q,ctrl+x or ESC # common escape commands for processes | |
ESC + b # go back a word | |
ESC + f # go forward a word | |
!33 # execute an item in the history index, in this case 33 | |
!! # previously executed command | |
!$ # last argument of previous command | |
!cd # will run the last command in history that started with the text, in this case cd | |
cat file.txt # print contents of file | |
cat file.txt | pbcopy # put file contents into clipboard | |
pbpaste # paste your clipboard | |
f # forward paging while in the man pages | |
b # backward paging while in the man pages | |
q # quit man page | |
Option + (Click) # move the cursor to a specific position | |
man -k searchTerm # search manual for search term results | |
cd - # toggle back to previous directory | |
tail file.log # print the end of a file | |
tail -f file.log # follow changes at the end of a file | |
head file.log # print beginning of a file | |
sudo chown user:group file.txt #change user and group permissions | |
sudo chown -R user:group folder #change user and group permissions recursively on a folder | |
chmod ugo=rwx #Give Read, Write and Execute access to User, Group and Other (short hand: chmod ugo+rwx or chmod a+rwx) using alpha notation | |
chmod u=rwx,g=rw,o=r #Give Read, Write and Execute access to User,Read and Write to Group and Read only to Other using alpha notation | |
chmod o-wx file.txt #Remove permissions using alpha notation | |
chmod 777 file.txt #Set permission on file with numeric notation. See alpha conversions: (r=4) (w=2) (e=1) | |
chmod -R 755 folder #Set permission on folder with numeric notation | |
sudo #substitute user and do | |
sudo -k #terminate session as substitute user | |
whereis #get location information about a command | |
which #get location information about a command | |
whatis #get information about a command | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment