Unix Cheat Sheet Profile
Unix Cheat Sheet

@unixcheatsheet

Followers
523
Following
0
Media
0
Statuses
14

A cheat a day keeps the sysadmin away.

Joined April 2009
Don't wanna be here? Send us removal request.
@unixcheatsheet
Unix Cheat Sheet
16 years
On that note, "pushd /tmp" changes your working directory to /tmp while remembering where you were; "popd" goes back to your previous dir.
0
1
0
@unixcheatsheet
Unix Cheat Sheet
16 years
Execute your previous command with "!!". Or fetch it with the up arrow key or Control+P.
0
1
0
@unixcheatsheet
Unix Cheat Sheet
16 years
Know your home directory shortcuts. "cd", "cd ~", or "cd $HOME" all change the current working directory to your home directory.
0
0
0
@unixcheatsheet
Unix Cheat Sheet
16 years
The -X parameter to ssh enables X forwarding; after "ssh -X user@host", you can run X apps remotely and they'll forward to your X server.
0
0
2
@unixcheatsheet
Unix Cheat Sheet
17 years
Get an updated list of processes with "top". By default, sorting is based on process IDs. Combine with "-o command" to sort by name instead.
0
0
0
@unixcheatsheet
Unix Cheat Sheet
17 years
Don't forget tar's support for compressed archives. "tar xvfz" for tar.gz's, "tar xvfj" for .tar.bz2's. (Also, the dash is now optional.)
0
0
0
@unixcheatsheet
Unix Cheat Sheet
17 years
Need to extract from an archive? Use "tar -xf /path/to/archive". Combine with -v to extract verbosely: "tar -xvf /path/to/archive".
0
0
0
@unixcheatsheet
Unix Cheat Sheet
17 years
Need to nuke all .DS_Store files on your Mac? "sudo find / -name .DS_Store -depth -exec rm {} \;" will do the trick.
0
0
1
@unixcheatsheet
Unix Cheat Sheet
17 years
And what if you want to redirect errors to a file? Use "2> /path/to/file". To redirect everything, use "&> /path/to/file".
0
0
0
@unixcheatsheet
Unix Cheat Sheet
17 years
Output to a file? Append "> /path/to/file" to your command. This overwrites the file, if it already exists. >> appends to the file instead.
0
0
1
@unixcheatsheet
Unix Cheat Sheet
17 years
"./command &" runs 'command' in the background. Forgot to include the &? Hit CTRL-Z and type in "bg" to run in the background.
0
1
1
@unixcheatsheet
Unix Cheat Sheet
17 years
On the topic of find, know -size's affixes! "find / -size +20c -size -40k" for files greater than 20 bytes, but less than 40 kilobytes.
0
1
0
@unixcheatsheet
Unix Cheat Sheet
17 years
"find . -name a*" will list files in the working dir and subdirs whose name begins with "a". Use -size and -type for greater specificity.
0
1
1
@unixcheatsheet
Unix Cheat Sheet
17 years
Learn your ls! e.g., "ls -lat" will list all files in the directory, incl hidden ones, sorted by date. Combine w/ less: "ls -lat | less".
0
1
1