This blog is ad-supported. If you find it useful, please consider disabling adblock for this site

making Linux even simpler

main page


Some useful Linux commands

October 2 2013

For some of us, fond to use the console, is a life-saver to have a handful of the most useful commands, this post is intended to list some of them. In some cases the programs are not installed by default, so you have to install them first, for example ffmpeg and curl (linux will tell you if the program is not installed).

Mount an .ISO file

To do exactly that when needed is really easy. First, as superuser, create the directory where you are going to mount the iso. For instance, something like this:

mkdir /mnt/mountedisc

then mount the iso. For example, if a iso image named mydisc.iso is saved in the directory /home/user/ it should be mounted this way:

mount -t iso9660 -o loop /home/user/mydisc.iso /mnt/mountedisc

Consult the definition of a word (english only)

To consult the definition of a word from terminal use this (instead of penguin write the word whose definition you want to know)

curl dict://

Use a memory card

To use a memory card (SD, mmc, etc) sometimes is as simple as executing a command for the computer to notice the card is plugged in. Insert the memory card in the slot, open a console, become root and type:

# echo 1 > /sys/bus/pci/rescan

Go to previous directory

If you are browsing your files in a terminal and then you move to some directory and suddenly you want to go back to the previous one, is as simple as

$ cd -

Tell the console to forget the command you are typing

Well, it's a really explicit description. To do that type the command putting a empty space before.

Record the screen

There are several other options but this one is really quick and and it's always there. It's not that flexible though

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq ~/video.mpg

"video.mpg" is the name of the file where the video is going to be stored. After you finish your recording press Ctrl+c

Fix typos quickly

The next one is not quite simple but is really useful once one gets used to it, it will allow you to correct a typo in the previous command. In this case is easier to use an example. Imagine you type something like this:

$ cd /home/marvib

but the last word was intended to be "marvin" instead of "marvib". Well, fix it with

It also works for entire words. Also, if instead of interchanging characters you want to delete a misstyped one, use the previous command but with only one argument

$ ls /home/userz

would be fixed by

$ ^z

Recycling commands

To use a previous command replacing a passed argument for a new one use this


It's very similar to the use of "^" but this one replaces every appearance of the previous parameter with the new one.

extra note: please avoid arguing about what commands and standalone programs are, I know I abused the word command in this post.

Geri Geri O. Morales
Maths Grad student at UNAM.
With experience in Linux server administration and web development

October 17 2013
Shridutt Kothari wrote:
Good commands