Nov 6, 2009

50 ways to impress your geeky linux friends

1. watch terminal star wars

To start this article off right, no Linux user can claim the status of geekhood unless they've seen Star Wars ASCII-style. To watch a fascinating version of Star Wars via the Terminal, type:


...and press ENTER.

2. kill a process

It's an embarrassing situation to have a browser fail to open due to the "process is already running" error, only to discover you've no idea how to kill that process (or any others, for that matter). To kill a process, open the Terminal and type:

ps aux

...and scroll through until you find the process you need to kill. The beginning of the data line will have a process ID number. Locate that number and type:

sudo kill -9 processID

...replacing processID with the actual number. Voila! Process terminated.

3. View Latest Log Messages

What to see the latest log messages? Type:

tail -f /var/log/messages

4. disable system beep

Linux insists on beeping at you; this isn't just any beep, however--it is a system beep, impervious to the mute button on your computer. If the startling, abrupt sound is like nails raking over a chalkboard to you, then this trick will let you kill that little beep forever.


sudo rmmod pcspkr

...and enjoy the silence.

5. rip dvd

While your friends, trapped in the infernal shareware trap that is Windows, grapple for an easy way to rip their DVDs, all you need is one tidbit of code. Insert the disc into your optical drive, then open the Terminal and type:

dd if=/dev/cdrom of=/cdrom_image.iso

...the disc will be saved as an ISO.

6. mount iso files

Lets say you've acquired a program's ISO and lack an optical drive (or a black DVD-R); how shall you run it? By mounting it in a 'virtual disc drive' of sorts. To mount as ISO, open the Terminal and type:

mkdir /mnt/iso make a directory for it, and then:

mount NAME.iso /mnt/iso/ -t iso9660 -o loop

7. Monitor Non-SSH Network Traffic

A good pass time when bored and a better way to see what is happening on the network, type:

tcpdump not port 22

8. encrypt files

If you keep any sort of sensitive data on your machine, encryption is your best chance at keeping data pickers from sneaking around your files and perusing the forbidden info. If you're running Ubuntu, you can just right-click a file and choose 'Encrypt File'. If you'd like a different option, install GnuPG. Once it's installed, open the terminal and type:

gpg -c filename.doc

...after which you will be prompted with:

Enter passphrase:

Repeat passphrase:

...choose a password you will remember, as you can't recover it. To decrypt a password, enter:

gpg filename.doc.gpg'll be prompted to enter the password you chose and open the decrypted file.

9. filter websites

So your kid brother or new guest or workers are visiting certain websites you don't want them to access. How do you block these sites? Open the Terminal and type:

gedit /etc/hosts

...replacing gedit with your favorite text editor. A file will open. In that file, add:

...replacing with the actual website name, and they won't be able to access that website.

10. Download a Website

You might find a website so good you just have to save it to a hard drive. Other times, you might need to archive a website before it goes under and find it easiest to download the entire site at once. To do this with the Terminal, type:


.... to download it all.

11. log off other users

Is someone on your network doing something they shouldn't? How would you like to bump them off the system without them knowing? To do this, open the Terminal and type:

skill -kill -u username

...replacing username with the actual system you want to shut down. This will only shut down their programs and then log them off, but it's enough to get the point across.

12. run multiple x servers

Running multiple X servers allows you to run your own graphical interface when you're using the computer, and allows a different user to run their own interface when using the computer. To accomplish this task is a bit more involved then this article wishes to cover. To view an excellent, in-depth tutorial on accomplishing this, visit:

13. Compile Source Code

At some point, you're going to need to install something that isn't compiled. You need to know how to install this, and it's not as hard as it seems. This method should work; there are times that it won't, however, as compiling code can be a time-waster.

Start by downloading the tar.gz and saving it to your desktop. Open the terminal and run:

tar xvzf program.tar.gz

...this will unpack the archive. Now CD to the desktop by typing:

cd desktop

...then enter:




...and finally:

make install install the program onto your computer.

14. Sniff Your Wifi

Maybe it's curiosity, or maybe you have a real need, but either way, it's useful to be able to 'sniff' your wifi; i.e, analyzing use, detecting networks, and detecting intrusions. There are a few different types of sniffers available, but the most popular one is Kismet. To install it, run:

sudo apt-get install kismet

...or the equivalent installation syntax for your distro. You'll find the program in your Internet menu.

15. Monitor Live Data

This command will be enough to entrance any geek for hours. With this, you can monitor real-time shifting data on your system via the Terminal:

watch -n.1 'cat /proc/interrupts'

16. Blocking Ads

Do you ever get tired of seeing Google ads, particularly adsense? Some users try to mix the adsense in with actual links to maximize clicks, which can make it difficult to navigate a website. Other common ads come from DoubleClick, etc. If you want to block those ads from working, you can do so by entering the following:

gedit /etc/hosts

...and adding:

....and any other sites you don't want to work.

17. Block IP Addresses

If you're running a server and having issues with a particular user, you can block that users IP address using IPtables. To install iptables, run:

sudo apt-get install iptables

...or whatever the equivalent is for your distro. Once installed, you can block an IP address by running:

iptables -A INPUT -s IPADDRESS -j DROP

...replacing ipaddress with the actual address.

18. Create a Ramdisk

Just the mention of a ramdisk might make your geek senses tingle. If you're in need of super fast read speeds, you can make a ramdisk easily using this command:

mkdir/ ramdisk

mount none -t tmpfs -o size=128M /ramdisk make a ramdisk that is 128MB in size. To make a different size, enter a different value.

19. hide your ip address

We won't speculate on the reason you may want to hide your IP address, but it's something every geek needs to do at one point or another. There are a few methods to do this, but by far the best and easiest method is using the wonderful onion-routing system that is Tor.

To install Tor, go to TORPROJECT.ORG and download the version for your distro. Install it according to your distro, then repeat the process with Privoxy

Now, I'm going to add the instructions straight from the Tor Project website so there's no confusion on what to do next (as a mistake could mean your IP is still visible):

"Open Privoxy's "config" file (look in /etc/privoxy/ or /usr/local/etc/) and add the line forward-socks4a / . to the top of the config file. Don't forget to add the dot at the end.

Privoxy keeps a log file of everything passed through it. In order to stop this you will need to comment out three lines by inserting a # before the line. The three lines are:

logfile logfile

and the line

jarfile jarfile

and (on some systems) the line

debug 1 # show each GET/POST/CONNECT request

Depending on which default config file you have for Privoxy, you may also need to turn off enable-remote-toggle, enable-remote-http-toggle, and enable-edit-actions. You'll need to restart Privoxy for the changes to take effect."

Finally, install the Torbutton add-on in Firefox so you can toggle Tor on an off in the bottom right corner of the browser.

20 Watch System Logs

If you're trying to get a device running or program working but something is going bonkers, it might be in your best interest to watch the system logs and see what's being reported. To do this, type:

tail -f /var/log/messages

21. check system uptime

If you need to know how long your machine has been running, a simple system uptime command will give you that info, along with users and a few other tidbits of info. To check system uptime on Linux, open the Terminal and type:


...yep, it really is that easy.

22. start a geeky fire

If creative art-types curl up in front of a roaring fire for inspiration, where do left-brain geeky types go to get the creative juices flowing? How about a roaring ascii fire in the Terminal? To get the fire blazing, type

sudo apt-get install libaa-bin

...and to run the fire, type:

aafire the terminal.

23. automatic backup

Automatic backups allow you to make sure your files are always backed up and safe from sudden loss or accidental deletion. The goal with backups is to be able to select files and have then update regularly. The method to do this is too involved for this article, so visit this excellent link to learn how:

24. Check Processes Others are Running

In the same vein as terminating a process, why not check up on what other's are running? To take a peek at your computer-mates running apps, open the Terminal and type:

ps aux | grep - v `whoami`

...and while you're at it, why not kill the process free up some CPU?

25. Launch a Program from Terminal

After manually installing an app, you might discover that the pesky little program disappeared; no matter what you do or where you look, it seems impossible to add it to the system menu. For just such a time, you'll need to know how to run a program using the Terminal. Type:


...replacing appname with the name of the actual program you wish to launch. Note that when you launch an app via this method, the Terminal must remain open for the app to keep running.

26. Fix a Screwed-up Terminal

If you play around in the Terminal long enough, you're bound to screw it up at some point. You'll know when it's borked--it starts beeping at you and spewing around random phrases like Uncle Sal after a kegger or two. To correct said problem, type:


...and watch serenity overcome the chaos.

27. Unmount a Drive in Use

Have you ever tried unmount a drive, only to have an error tell you that some mysterious program you neither see nor remember starting is using said drive? The solution is to kill that process so the drive can be unmounted. How do you find out which process is tying up the drive? With this piece of Terminal code

lsof +D /mnt/windows

...and it'll not only tell you what program is using the drive, but will also give you it's process ID. Use the kill process tip above to terminate this process and safety unmount your drive.

28. Clear Personal Data upon Logout

When you logout, you want all traces of your activities to be cleared from the computer. Most distros will do this all their own, but if you're running a particularly finicky system, you might have to manually add that feature. To make the computer clear remnants of your last foray on the system, open the Terminal and type the following:

gedit ~/.bash_logout

...replacing gedit with 'kate' or whatever your favorite text editor is. When the text file opens, add:


...and hit Ctrl+s to save; if your distro allows it (ahem, Ubuntu), use clear_console instead..

29. Prevent SSH Root Login

You don't want an unauthorized someone to log into your sever as a root user, which gives the full breadth of destructive powers to them. To prevent that, change the settings so that root login is impossible. To do this, open Terminal and type:

gedit /etc/ssh/ssh_config

...and add:

PermitRootLogin no the text file that opens, preventing users from logging in as the all-powerful root user.

30. Find Old Commands

Looking for an old command you ran that you can only vaguely remember? To find it, you use this query in the Terminal:

history | grep -i "keywords"

...where keywords is the parts of the command you remember. It will search and display all previously run commands with those keywords and show you an ID number. To rerun that command without typing it again, you can type

! IDnumber

31. Erase all data traces

If you're planning to delete something sensitive, such as a file or photo, and don't want any traces of that data to remain on your hard drive, you want to use this command. Be very careful!

shred -z -u file

...will write over whatever file you point it to with different data a few times before deleting it forever.

32. Speed Up the Gnome Menu

If you're a blazing fast type of person, you probably find Gnome's menu delay more frustrating than stylish. If you want to rid yourself of that delay, type this into the Terminal:

gedit ~/.gtkrc-2.0

...replacing gedit with your favorite text editor. In the file that opens, add this text:

gtk-menu-popup-delay = 0 the file.

33. Restarting When Frozen

Sometimes your system will just freeze. When that happens, you're left with the option of waiting it out or resetting. How do you reset without do damage to your data? Simple.

Press ALT + Sys Rq and, while holding those buttons down, type: REISUB. The system will restart safely.

34. Disabling Touchpad

How many times have you been playing a game, only to graze the laptops touchpad and have it mess something up? The solution is to disable it's function. To do that, refer to this detailed tutorial on disabling the touchpad in Linux.

35. Backup Your System

Backing up your system is the ultimate way to be prepared for a system crash. To do so, follow these steps:

Run Terminal as root.

type: cd /

tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

This will create an archive of your system. Be sure you have enough hard drive space to handle it.

36. Customize the Terminal

If you spend most of your time in the Terminal, then it's only fitting to customize it to meet your needs. There are many different ways to change the Terminal's look--too many to list here. To see the dozens of options available to you, as well as how to apply them, hit up this link:

37. Ejecting CD/DVD Drive

Sometimes you'll push the button on the DVD drive and nothing will happen. For those times, there's a simple way to get it to open. In the Terminal, type


...and it will pop open.

38. Collaborating Between Screens

Lets say you have two Linux users in the same space but different rooms. You want to show one person how to do something, but you don't want to get up. How do you solve this dilemma? By collaborating the screen. This method will allow you to both see the same screen and see the actions each other do on it.

su - username

...where username is the username of the machine whose screen you want to see...

ssh machine

...replacing machine with the name of whatever computer the other person is on....

screen -S foo

...both of you type this into your own machines and voila! You're both now sharing the same screen.

39. Examine the CPU

Are you in need of detailed info about your CPU? Then use this code:

cat /proc/cpuinfo

...and you'll get a whole slew of info

40. Stopwatch

Every need to time something on the fly and happen to lack a watch? No worries!

time cat

...and press control+d to stop the timer.

41. Schedule a Download for the Middle of the Night

Sometimes you want to download something that is large and will take quite a time. The best time to do this is the middle of the night (or while you're away). To schedule a download for a certain time, type this:

echo 'wget url' | at 01:00

...changing URL to the actual web address and the time to whatever (24-hour clock).

42. View Available Wifi

Do you want a quick and simple list of available wifi networks, as well as a whole slew of info about them? If so, type:

iwlist scan

43. Find Website IP Address

School and work proxies often block websites but not IP addresses--you can access a banned address by entering that websites IP address instead of it's normal .com address. Some places ban the popular sites that allow you to lookup a websites IP address, but you don't need them. To find out a website's IP address, type:


44. Terminal Three-month Calendar

If you're running a bare-bones window manager, such as blackbox, the fastest way to see a calendar is with the terminal. To see this, type:

cal -3

...and it will display a three month calendar.

45. HTML to Text Conversion

Do you want to quickly turn a text file into an HTML file? Use:

recode ..HTML <> file.html

46. Rip Music CD to WAV

What fun is working on the computer without a little music? While your friends are busy searching for a decent music ripping program, you can copy an audio cd to WAV files using this simple command:

cdparanoia -B

47. Find the Biggest CPU Hog

Is a certain process running your CPU right into the ground? How do you find said process without picking your way through the ps aux results? With this command:

ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d' which point you can kill it with sudo kill -9.

48. Reboot History

If you need to see your current machines reboot history, type:

last reboot

49. Battery Checkup

Is your computer battery lasting less and less every week? Check the charge capabilities of your battery by typing:

grep -F capacity: /proc/acpi/battery/BAT0/info

50. All the Little Filesystems

Particularly useful if you're mounting different drives, using the following command will allow you to see all the filesystems currently mounted on your computer and their respective specs:

mount | column -t


No comments:

Post a Comment