Command Line Magic (climagic)
-
awk '{t=substr($0,22);if (l!=t){print $0}; l=t}' log # Only print lines where things that matter change, ignoring the timestamp (first 21)
-
pianobar # Pandora music client for the command line. And like many CLI clients, it actually has more control and features. ;-)
-
xrandr -q # This is one of the ways to figure out what screen resolution X windows is in from the command line. xrandr can switch res too.
-
last -da | grep pts/ | egrep -v "^(user1|user2) " # Look at all the last interactive logins (no ftp) and also exclude user1 and user2
-
fdisk -l /dev/sd? # If you're on a system with device mapper devices that also list when you run fdisk -l, try this match for brevity.
-
sed '/^$/d' prog.c > proc-condensed.c # (over)write prog-condensed.c with the non-blank lines in prog.c. For @Jayantshobhawat
-
tr -d $'\n' # Remove the trailing newline(s) from its input. If you like the chop/chomp command in Perl or PHP, this is for you.
-
nohup serverprocess # Poorly written server software can benefit from nohup by detaching from your shell so you can exit cleanly.
-
egrep -e "ROOM1? " /var/log/cups/access_log # Search for printers called ROOM or ROOM1 in the cups access log. Won't match ROOM2, 3, etc.
-
Some people worry about losing hair, hearing or sight with age. I worry about forgetting which window I'm in when I press enter. Whoops
-
umask 077 # Set your default file and directory permissions to 600 and 700 respectively. Good to do in scripts, especially running as root.
-
A watched pot never boils; The same is true for a broken service running in debug mode.
-
find . -name '*.php' -type f -print0 | xargs -0 wc -l | grep total # Get a rough idea of how many lines of code are in a PHP app.
-
ssh -g -L 8025:smtp.otherisp.net:25 http://ur1.ca/8ahod # Setup SMTP tunnel (listening on yourhost:8025) and allow others to use it (-g)
-
mkdir -p Maildir/{new,cur,tmp} # Create a Maildir folder with its subdirs all at once. -p option creates parent dirs if they don't exist.
-
df -i # Show the number of inodes used on each filesystem (some don't report this). Useful for quickly determining how many files you have.
-
http://ur1.ca/89yuu # It had to be made.
-
awk '{print substr($4,0,17)}' access_log |uniq -c # Print number of hits for each 10 minutes in a CLF webserver log file to find spikes.
-
awk 'NR>1' datawithheader.csv # Start processing in awk with the second line of input. Useful for skipping headers. Thx @davidmaxwaterma
-
Consultant just said "I got the blue circle of death. That's what I call it, what do you call it?" Me: "Windows. I use Linux."