Saturday, September 1, 2012

Top 20 terminal command of ubuntu

1. Kill a running application by its name

killall [app_name]

2. Display disk space usage:

df –h

3. Locate the installation directories of a program:

whereis [app]



4. Mount an .iso file:

mount /path/to/file.iso /mnt/cdrom –oloop

5. Record or capture a video of your desktop:

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

6. Find out the Universally Unique Identifier (UUID) of your partitions:

ls /dev/disk/by-uuid/ -alh

7. Show the top ten running processes (sorted by memory usage):

ps aux | sort -nrk 4 | head

8. Make an audible alarm when an IP address goes online:

ping -i 60 -a IP_address

9. Run the last command as root:

sudo !!

10. Make a whole directory tree with one command:

mkdir -p tmp/a/b/c

11.. restart : Restart the computer
 restart

12. shutdown : To shutdown the computer from terminal
shutdown -h

13. gksudo : Run GUI Application with Root privilege
gksudo nautilus

14. wget : Download files from server

GNU Wget or wget is very handy in downloading stuffs from internet, over the command line.
wget url_of_the_content

15. mv : rename or move a file/directory
mv file1 ~/Downloads/Archive/

the above command will move the file from the current directory to target directory.
mv logo_2.jpg new_logo.jpg

it will rename the file to new_logo.jpg.

16. sudo : superuser do, to gain root privilege

e.g
sudo apt-get install gnome-shell

Then enter your user account password, and you would be able to do administrative tasks like root. So if you’re getting any permission error using a command, then adding sudo as a prefix, might help.

17. rm : remove/delete file/directory
rm useless.sh

NOTE : it removes directories only if it’s empty, unless you specify -f flag for force deletion. But you must be careful with the arguments such as -r, -f. (-rf is very dangerous).

18. mkdir : make/create directory.
mkdir funny_stuffs

19. pwd : print the current/working directory
pwd
/home/Desktop/scripts

20. cd : Change Directory
cd ../
cd /home/Desktop

Remember,

. represents the current directory

.. represents the parent directory

~ represents the home directory (of the user)

No comments:

Post a Comment