Skip to main content
  1. Archives/

5 Commands Every Linux Newbie Must Know

··476 words·3 mins·
Tips & How-To's Commands Tips Tutorials

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

here 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).

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

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

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

Then untar using the command

tar xvf

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

  1. 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

dpkg -r

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

For apt-get: apt-get install

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

  1. 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

  1. 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.

Sathyajith Bhat
Author
Sathyajith Bhat
Author, AWS Container Hero and DevOps Specialist.

Related

3i-Infotech, Here I come
··150 words·1 min
News
Well, I’d been to Bangalore to collect my offer letter for a job as Trainee Software Engineer at 3i-Infotech yesterday. Most of the people who had cleared the GD, seemed to have cleared the Personal Interview as well, atleast most of the people who were in my group. The joining formalities was headed by a HR person named, Anupama, and boy was she grouchy! Is she always so? Whatever it maybe, I’m glad she wasn’t the one taking my interview.
Howdy!
··85 words·1 min
News Hello World
Howdy folks. After my first attempt at blogging, which was “very successful”(thanks to me of course, I was too active, you know!) I’ve decided to start my blogging “career” all over again. Hope I will be more motivated than ever to maintain this, thanks to a certain “jobless” friend of mine, who kept pestering me about my nonexisting blog. If you’re still reading this, wow well and good! Hope to hear some “interesting” comments, brickbats and rants from ya all.