pico // an easier text editor than vi
rm -rf // remove recursivly without prompting for verification of each file
ln -s [path to link to] [link being created] // create a symbolic link
unzip // unzip a zip file
tar -vxzf archive_name.tar -C /tmp/extract_here/ // extract to directory
tar -vczf archive_name.tar directory_to_compress --exclude "/path/directory" // compress
locate -- find stuff (like Spotlight on a mac)
find . | xargs grep 'string' -sl -- find 'string' in all files recursively
find . -iname '*php' | xargs grep 'string' -sl -- find 'string' in all files ending in .php recursively
find . -name *.mp3 // print out all file paths for files matching a pattern
Move
'control a/e' - move to front/end of the line
'right/left arrow' or 'control f/b' - move curser right and left
Delete
'delete' or 'control h' - delete before cursor
'control d' - delete after cursor
'control w' - delete word before cursor
'control u' - delete everything before cursor
'control k' - delete everything after cursor
Past commands
"history" - list all previous commands
!! - run previous command ( you can add test before or after it.)
'control r' - searches previous commands ('control r' again to find next result)
'esc' - copy command from past to edit it
'up/down arrow' or 'control p/n' - navigate previous commands
rsync -a -- delete
rsync -e ssh -av --delete --stats --progress --exclude 'lm.ole.org' --exclude 'qa.library.ole.org' /srv/www-ole/aegir/6.19/ o1.ftp@o1.th.ole.org:/data/disk/o1/static/drupal-6.19/
scp source destination -- copy a file from one computer to another ( add -r for directories or use rsync)
screen -r // reattach
ctrl+a // get to screen command prompt
d // detach
screen -d -m -S shared // create screen for someone to connect to called "shared
screen -x shared // attach to someone else's screen http://wiki.networksecuritytoolkit.org/nstwiki/index.php/HowTo_Share_A_Terminal_Session_Using_Screen
arrow keys do not work in vi, only in vim
:[#] or [#]G -- take you to like number
G -- go to bottom of the file
control b/f -- page up/down
0/$ -- beginning/end of the line
w/b -- forward/back a word
I/A -- insert at beginning/end of line
X/x -- delete before/after cursor
dw/db -- delete word before/after
dd -- delete line
u/redo -- undo/redo
:%s/^.\{1}// -- remove the first 1 characters from each line
:g/text -- show lines containing "text"
:g/text/d -- remove line containing "text"
:v/pattern/d // remove line NOT containing "pattern"
:%s/foo/bar/g -- find foo and replace it with bar
q -- quit
q! -- quit without saving
x -- quit and save
:w - save document
:w <filename> - save as <filename>
:wq/ZZ - quit and save changes
:e! -- revert to last saved version
Y,2Y,10Y,yG - copies 1,2,10,to the end of the document
P/p - pastes above/below the cursor
/ - search/find (type the string you are looking for after the /)
? - search backwards
n/N -f find next/previous1
:%sort u - sort (add u option to remove duplicates)
ggVGu // lowercase entire file. gg = got to first line, V = Start visual select, G = go to last line, u = lowercase selection
VIM notes -- http://www.brezeale.com/technical_notes/vim_notes.shtml
top
w
ps aux | grep <preocess> -- find a running process
mount -- http://linux.justinhartman.com/Installing_a_second_hard_drive
tail -f /var/log/syslog - view system log in real time
uname -a -- which linux version
less /etc/debian_version -- which version of Debian are you running
Disk space/size
du -hc --max-depth=1 | sort -h // calculate size of all directories on the system
df -h // disk space
ncdu -x <some folder> // ncurses GUI, the x switch is there to not cross filesystem boundaries.
adduser username group // add user to group
whoami // which user is running
sudo -u o1 bash // switch user to o1
Drush
drush topic // like a TOC for a man page
rsync linux system
rsync -aAXv /* /media/usb/BACKUP/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs} // i.e guru
https://wiki.archlinux.org/index.php/Full_System_Backup_with_rsync
grep -r "search phrase" /path/to/search - search in all files recursively
Alias NICKNAME='full command here' // Make Alias
ssh -A -- Use local private key from remote machine
du -h --max-depth=1 -- human readable size of all sub directories and total
See sftp://shell.sugarlabs.org//srv/home/crowe/sugarlabs%20admin%20commands.txt for more.