Tips & How-To's

5 Commands Every Linux Newbie Must Know

Although Linux had progressed far from being a command-line only OS to a full fledged totally GUI based one, sometimes, the command line is the best way to get something done. Here are 5 of the must-know commands. These commands can b quite useful and handy.

1: mount: Used for mounting Windows/Other partitions, just in case it isn’t automatically mounted.

Usage:

mount <device> <mount-point>

here <device> refers to the special device where your partitions are.
Rather than referring to partitions as drive letters as Windows, every partition in Linux is indicated by a special device. For eg in case if IDE(parallel ATA drives) the Primary master will be /dev/hda and the primary partition will be /dev/hda1(Windows C:) and the logical partitions will be /dev/hda5, /dev/hda6 and so on(for Windows D:, E:.. so on).

<mount-point> indicates to which directory you want the partition to be available as.

Please note that mount command requires root privileges, so run the command as sudo ie,
sudo mount <device> <mount-point>

Eg: If you wish to mount the Windows C partition to a /windows/C the command will be,sudo mount /dev/hda1 /windows/C

For SATA drives, the “hdx” will be replaced by “sdx” ie, instead of /dev/hda1

it’ll be /dev/sda1

2: tar/bzip2/bunzip2: For extracting archives, this command is useful for extracting to directories other than the home directory, where root privileges are required

Usage:
(i) For GZipped files(.tar.gz extension)

tar xvfz <archive-name>

Eg: If the archive name is some-file.tar.gz, then the command will be

tar xvfz some-file.tar.gz

(ii)For Bzipped files (.tar.bz2 extension)

First, unzip the archive using

bunzip2 <archive-name>

Then untar using the command

tar xvf <archive-name>

Eg: If the archive is some-file.tar.bz2 then first unzip it using

bunzip some-file.tar.bz2

You’ll get the file some-file.tar. Next untar it using

tar xvf some-file.tar

3. rpm/dpkg – Install/Upgrade/Remove RPM/Debian Packages

Usage:

(i) Installing new packages

rpm -ivh <package-name.rpm>

dpkg -i <package-name.deb>

(ii) Upgrade existing packages

rpm -Uvh <package-name.rpm>

dpkg -i <package-name.deb>

(iii) Removing existing packages

rpm -e <package-name>

dpkg -r <package-name>

Note that these commands are suited for individual commands, whose dependencies are met. For complex packages, having many dependencies it’s better to use apt-get/smart.

For smart: smart install <package-name>

For apt-get: apt-get install <package-name>

Again these commands require root privileges, so prefix sudo before each of these commands.

4. cat – Concatenate files and print on the standard output. Useful for viewing short text files, logs without having to open any editors

Usage:

cat /path/to/file

Eg: cat /var/log/syslog

If the text file is lengthy, pipe it via more to scroll ie

cat /path/to/file |more

Eg: cat /var/log/syslog |more

5. dmesg – The program helps users to print out their bootup messages. Instead of copying the messages by hand, the user need only:

dmesg > boot.messages

and mail the boot.messages file to whoever can debug their problem.

dmesg |tail Outputs only the last part of dmesg, and is useful to identify any errors, which occured, say if a removable drive is inserted.

10 Comments

    1. Dear Satya..
      ur posts on Linux are really cool… Thank you for those tips and fixes on various Linux stumblers…Can u give me few tips on formatting my USB Pendrive on NTFS/FAT 32 with Ultumix OS
      My pendrive doesnt show up auto matically
      How Do I know if the system is recognising or reading my pendrive.. how to find out the pendrive if I have not labelled it at all before.. How to then open a terminal where I can see if the system is reading my USB Pendrive.. Lot of help on formatting was given by you on google search tried here and there butu I didnt get to format my pendrive though.. my email is srinivasayyar@gmail.com
      Thank you
      Srini

  1. hey, i really liked the post…
    Its very clear & precise. Have seen ppl using these commands, but now i clearly know wat they do. thanks :)

  2. Dear Satya..
    ur posts on Linux are really cool… Thank you for those tips and fixes on various Linux stumblers…Can u give me few tips on formatting my USB Pendrive on NTFS/FAT 32 with Ultumix OS
    My pendrive doesnt show up auto matically
    How Do I know if the system is recognising or reading my pendrive.. how to find out the pendrive if I have not labelled it at all before.. How to then open a terminal where I can see if the system is reading my USB Pendrive.. Lot of help on formatting was given by you on google search tried here and there butu I didnt get to format my pendrive though.. my email is srinivasayyar@gmail.com
    Thank you
    Srini

Leave a Reply

Your email address will not be published. Required fields are marked *