Some very useful Linux command-line tips and tricks for the desktop user.

Posted: September 20, 2012. At: 6:16 PM. This was 5 years ago. Post ID: 4585

Windows NT4.0 Server. Neanderthal technology.
Windows NT4.0 Server. Neanderthal technology.

Using the install-mbr command to install a main boot record (MBR) onto a disk.

[flynn@flynn-grid-runner media]$ sudo install-mbr --force --partition 1 /dev/sdi
[sudo] password for flynn: 
[flynn@flynn-grid-runner media]$

This command would be useful if you are building a custom image and you need it to be bootable.

On this website in Japanese there is a FizzBuzz program in Awk. I have reproduced it below.

#! /usr/bin/gawk -f
    $0f ($0 % 3 == 0 && $0 % 5 != 0) {
        print "Fizz";
    } else if ($0 % 3 != 0 && $0 % 5 == 0) {
        print "Buzz";
    } else $0f ($0 % 3 == 0 && $0 % 5 == 0) {
        print "FizzBuzz";
    } else {
        print $0;

To update your Twitter status from the command-line the Twidge client will perform this task admirably.

To view the uptime of your Linux machine use the uptime command.

[flynn@flynn-grid-runner ~]$ uptime
 17:48:25 up 42 min,  2 users,  load average: 1.49, 1.50, 1.41

A useful Linux distribution to use when Learning Linux is the Backtrack security testing distribution. 3.1 Gigabytes. This distribution is packed with a heap of penetration testing tools such as Nmap and many forensic and network testing tools to test the security of your network. Another way to learn Linux is to use the website. This site uses a Javascript PC emulator to run Linux in a web page. This is an invaluable tool for practising your Linux commands on a Windows computer.

The pidof command will show the process ID of a running process. You may then run the kill 4044 to kill this process if you wish.

[flynn@flynn-grid-runner ~]$ pidof konsole

The uniq command will remove duplicate lines from a text file or from piped input. This example below shows the usage of this command upon a text file.

[flynn@flynn-grid-runner ~]$ cat hello
[flynn@flynn-grid-runner ~]$ cat hello | uniq -u
[flynn@flynn-grid-runner ~]$

The sort -u command will also filter repeated lines in our text file.

[flynn@flynn-grid-runner ~]$ cat hello | sort -u
[flynn@flynn-grid-runner ~]$

Use the finger -lmps command to print much information about your user.

[flynn@flynn-grid-runner ~]$ finger -lmps
Login: flynn                            Name: Flynn Taggart
Directory: /home/flynn                  Shell: /bin/bash
On since Thu Sep 20 17:07 (EST) on pts/0 from :0
   45 minutes 32 seconds idle
On since Thu Sep 20 17:27 (EST) on pts/2 from :0 (messages off)
No mail.
[flynn@flynn-grid-runner ~]$

This command requires superuser privileges and will display the temperature of the hard disk given as an argument.

[flynn@flynn-grid-runner ~]$ sudo hddtemp /dev/sda
/dev/sda: ST3500418AS: 27°C

Another way to uncompress a *.tar.gz file is the uz command.

[flynn@flynn-grid-runner Downloads]$ uz SyntaxHighlight_GeSHi-MW1.19-108171.tar.gz 
Extracting from  "SyntaxHighlight_GeSHi-MW1.19-108171.tar.gz".

No comments have been made. Use this form to start the conversation :)

Leave a Reply