Assorted Fun Linux Command Line Hacks Today's fun command line festivities are inspired by Command Line Magic, who hangs out on Twitter sharing excellent Linux command line incantations for all occasions. Today's assortment includes shell rainbows, Is the Internet on Fire?, Star Wars Traceroute, and creating annoying sounds from the console. Rainbows In Your Shell This little gem creates a colorful scrolling display. Ctrl+c stops it: $ grep -o --binary-files=text '[[:alpha:]]' /dev/urandom |tr -d '[a-zA-Z]' |xargs -n $(($COLUMNS/2)) |tr -d ' '| lolcat -f | pv -L80k Figure 1: Instant alien language. lolcat creates the colors, pv controls the speed, and the COLUMNS value controls the width of the columns. $ grep -o --binary-files=text '[[:alpha:]]' /dev/urandom |tr -d '[a-zA-Z]' |xargs -n $(($COLUMNS/2)) |tr -d ' '| figlet | lolcat -f | pv -L80k So maybe they're alien words. $ yes "$(seq 231 -1 16)" | while read i; do printf "\x1b[48;5;${i}m\n"; sleep .02; done Figure 2: ASCII colors galore. Is the Internet on Fire? $ ls -R / | aplay
Android from the command-line - Antoine Amarilli's blog Something I hate about Android is that there are almost no bridges between the usual *nix command-line world and the brave new world of Java. If things had been done properly, for instance, you would be able to ssh to your phone and run a trivial bash one-liner to save the current GPS coordinates to the SD card every 30 seconds, instead of having to write a verbose Java application to do that (or installing a third-party app which will come with all sorts of bells and whistles). Also, if things had been done properly, there wouldn't be obscure terminal glitches and bizarre and gratuitous deviations from the FHS... Now, my Android phone fell, the screen broke, and I am left with a perfectly functional ARM-based computer with a lot of usable hardware, such as: Wifi with master mode supportSpeakers and headphone plugMicrophone and cameraGPSVibrator and notification LEDGSMBluetooth Connecting to WiFi (managed mode) Setting the time Getting Debian Creating a WiFi access point (master mode)
Example uses of the Linux Command find The following examples illustrate typical uses of the command find for finding files on a computer. find / -name game Looks for a file named "game" starting at the root directory (searching all directories including mounted filesystems). The `-name' option makes the search case sensitive. find /home -user joe Find every file under the directory /home owned by the user joe. find /usr -name *stat Find every file under the directory /usr ending in "stat". find /var/spool -mtime +60 Find every file under the directory /var/spool that was modified more than 60 days ago. find /tmp -name core -type f -print | xargs /bin/rm -f Find files named core in or below the directory /tmp and delete them. find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. find . find $HOME -mtime 0 find . find .
Useful Commands For The Linux Command Line This short guide shows some important commands for your daily work on the Linux command line. arch Outputs the processor architecture. $ arch i686 cat Outputs the contents of a file. $ cat lorem.txt Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. cd Change the working directory. $ cd /bin chgrp Change group ownership of files. $ chgrp games moo.txt chmod Change access permissions of files. $ chmod +x helloworld chown Change file owner and group. # chown root lorem.txt cksum Print CRC checksum and byte counts of each file. $ cksum lorem.txt moo.txt 3570240675 453 lorem.txt 4294967295 0 moo.txt cp Copies a file. $ cp lorem.txt copy_of_lorem.txt date Outputs the current date and time. $ date Sat Mar 3 12:07:09 GMT 2007 df Reports the amount of disk space used and available on filesystems. $ df Filesystem 1K-blocks Used Available Use% Mounted on<br> /dev/simfs 39845888 218048 39627840 1% / dir List directory contents. $ dir du $ du -h /bin 7.8M /bin echo
Understanding Sound The Decibel - dB The Decibel (dB) is the unit of measurement used in sound systems A Decibel (dB) describes a ration between two quantities expressed as a logarithm. Logarithms are used because our ears hear differences in loudness as a Log function. Frequency Range of the Human Voice Voice range covers 300 Hz to 3500 Hz Most energy concentrated below 1000 Hz Vowels have most of their energy below 1000 Hz Vowels contain the "power and impact of the voice" Consonants have most of their energy above 1000 Hz Consonants are responsible for intelligibility Harmonics in voice can go above 3500 Hz Poor high frequency response reduces intelligibility Recognizing the Frequency of Sounds It is important for a sound technician to learn to recognize the frequency of sounds so you are able to quickly and correctly adjust equalization when there is a problem (i.e. feedback, hollowness, nasal sound, boomy, etc.) Ear Sensitivity Dynamic Range Feedback Control