Skip to main content

Eleven Really usefull Linux Tips


1. Making linux files and folder unalterable : -

Suppose one has a folder/file 'linux' and you want to make it unalterable so that it does not get deleted mistakenly. This can be done with the following command

chattr -R +i [Replace this with the folder address , in this case it is /home/ambuj/linux]
After completeing the step the folder becomes unalterable and even the superuser - ' root' cannot delete the folder.

Now if you again want to delete the folder it can be done first by removing these attributes from the folder

chattr -R -i [ Folder address, /home/ambuj/linux in this case ]
Now the folder can be removed.

2. Resetting user password

There are often case when some new user forgets his/her password , this password can be reset by the root user
using command

passwd [name of user]

this will ask for new user password of the user.

3. Recovering lost root password

if one has lost his root/superuser password , then the password can be easily be reset to a new password using the following steps : -

If you have grub installed as a boot manager at the boot screen type 'e' to enter into edit mode select the kernel you want to load and add 'single' at the end . Exit the edit mode and boot into the kernel by typing the b mode . this will enter the user into a single user mode where from one can change the root password by typing the command : -


if you have LILO installed as boot manager then

type linux single at boot prompt. to boot into a single super user mode .

after booting into the single superuser mode type

passwd to reset the password.

However if you are running graphical LILO then enter the text boot: prompt by typing Ctrl + X and repeat the above steps.

4. Playing mp3 files at command line

mpg123 is command line based audio player that forms the backbone of number of graphically available Audio players , it is one of the most efficient player on the Linux platform and can play mp3 files on as low hardware specs as a 120Mhz Pentium Processor based computer . A similar command line application is mpg321 that can be used for playing mp3 files.

mpg123 or mpg321 file name - To play mp3 file

Ctrl + C - This skips to next track

Typing Ctrl + C Twice - quits the application

mpg123 -z *.mp3 : - Command would play all the mp3 files in the directory with a shuffled play-list.

mpg123 -w filename.wav filename.mp3 :- This command would convert the mp3 file to wav file , whic can then be used for burning on to cd to make audio cd.

However if your audio files/file is located in some location in sub-folders and u don't know exact location then following command can be used

mpg123 $ (find -name "Filename")

5. Running any application with keystrokes in Metacity(Gnome)

In Gnome it is very easy to run any program you want with a keystroke , you can assign any program to a keystroke and the program would launch when you type those keystrokes. For Example : if you assign + F for File Roller (Archive Manager) everytime you press this File Roller application would open.

To do this first launch gconf-editor

Now open apps -> metacity -> global keybinding

Now choose the keystroke you want to associate command with for example chose run_command_1 and type the value +(KeyStroke) where KeyStroke is the KeyStroke you want to associate the command with.

After doing this go to apps -> metacity -> keybinding_command and chose the command you have set the value , and put the name of command you want to execute as the value of the command . Now exit the gconf-editor , the KeyStroke should have been properly adjusted now when you type the selected KeyStroke your selected command is executed.

6. Creating symbolic links in linux

Symbolic links if you have used windows is way of making short cuts in linux , now using a symbolic link you can refer to any file or directory by another file name in different directory .

To create symbolic links : -
ln -s [Path of script , folder file] [path where to create shortcut/name of shortcut]

example : to create symbolic link of folder /windows type ln -s /windows /home/amXXX/win
Creates link of folder /windows at /home/amXXX with name win.

7. Creating Directories and subdirectories quickly

Directories and sub-directories can be created quickly with a single statement saving some of your time. For example if you want to create the following directory structure

Temp -> a ->(b -> c) , d->(e->f->g),h,i,j

you can do this with the following commands

mkdir temp
cd a
mkdir b
mkdir c
........ (and so on)

or you can reduce the number of commands typed by using a statement like this : -

mkdir -p Temp/{a/b/c,d/e/f/g,h,i,j}

This would create all the directories in single line without you having to type a lot of mkdir and chdir.

8. Extracting a archive in a particular directory

If you want to extract a particular archive in a particular directory you don't have to move the archive to that particular directory and chdir to that directory and extract the archive this can be done easily by using command like this : -

Example : to extract file newfile.tar.gz to directory Temp/a/b use following command

tar xvf -C Temp/a/b newfile.tar.gz

9. Viewing listing of files in particular directory page wise

If you have a really long file list in a particular directory you can view the files page wise by piping the output ls to more command.

ls -l | more would view the content of the directory page-wise.

10. Turning off annoying PC Speaker Beep

If you are really annoyed by the beep computer produces using the PC speaker you can turn it off using the following command : -

rmmod pcspkr

To re-enable the PC Speaker beep use the following command

modprobe pcspkr

11. Changing the background of nautilus file manager

Nautilus file manager by default doesn't provide a way of changing the background of file manager , how ever if you want to set the background of nautilus file manager to something different say pic.jpg file this can be easily done by the following command .

gconftool-2 /apps/nautilus/preferences/background_set -t bool -s true

gconftool-2 /apps/nautilus/preferences/background_filename -t string \-s {Image name with path}


  1. Thanks for the tips, I am hoping that I will learn Linux someday and I wanted to have that kind of knowledge regarding operating systems.


Post a Comment

Popular posts from this blog

13 Things to do immediately after installing Ubuntu

In this article i describe some of the things to do immediately after installing ubuntu on your machine . Since most of the people reading this would be shifting from Windows to Linux with a system dual booting so i would focus more on making transition easy from Windows to Linux.

Creating Your ultimate Ubuntu 7.10 Desktop

Ubuntu 7.10 Codenamed Gusty Gibbon was released few weeks back with much fanfare ,now Ubuntu for past couple of years has been one of the most popular Desktop Linux distributions . Ubuntu 7.10 includes a number of features , applets and Wizards to simplify desktop Linux experience however because of many licensing restrictions it does not include out of the box support for popular audio/video codecs and many commercial but good applications . Also because of the limitation of trying to accommodate all kind of applications on single CD Ubuntu comes with a limited set of applications .

Now , i often have arguments with my friends who are new to computers that windows is…

Over 16 Small Games For Ubuntu Linux

Over 16 Small Games For Ubuntu Linux

Ubuntu Linux is one of the most popular Linux distribution , it is especially popular among Linux newbies and windows refuges . Now Ubuntu Linux does come with a descent set of applications , still there is a scope for including some more quality applications and especially games . Now in this tutorial i will show you how to install a large number of small , easy and less resource hungry games on Ubuntu Linux with screen-shots of games .

1. Rocks 'n' Diamonds

Rocks 'n' Diamonds is a Boulderd*sh game for X11 with more than just the falling rocks and diamonds of its namesake. The object is still to collect all the diamonds (and emeralds), then get to the exit before time runs out. But your character must make use of bombs, spaceships, and many other elements in order to fill his quota of jewels.

Installation : -

Type the following command in the terminal window


Making Music(Beats) on Linux/Ubuntu with Hydrogen

I am going to review a couple of Music Making Softwares for Linux and am starting with the simplest and one of the best!HYDROGEN. Hydrogen basically is a pattern based drum programming software which in layman terms means, it allows you to make your own beats.And in case you aren't much into music, you might be wondering “what the hell will i do with this piece of software”...well here is a word from my friends who've tried this: “Its pretty fun playing with this software, n even without knowing much, you could actually MAKE SUM MUSIC!!!”

There was this software called Acoustica Beatcraft(for windows) which actually introduced me to this beat making stuff and I was quite interested, but sadly it was too costly for me to buy it. So i was stuck using the trial version of the software and sadly as soon as i got the grip of the software the trial expired, and so my search began for software which would do the stuff for me and luckily i found this amazing piece of software HY…