Basic Linux Commands | usefull for a webdeveloper

List Directory


Find a file or directory

shell>find filename

Edit a File 
shell>vi filename.txt

Then file will be open,
if you want to save that file
1. press Esc
2. Type ":" (colon)
3. Type "wq" (w- write,q - quit) | Type "q!" (quit without save/write )

Mysql Prompt

shell>mysql -u username -p databasename

Then give password

MSQL Dump or database backup with command prompt

shell>mysqldump -u username -p databasename > backup/backupfile.sql

Then give password

[username] – this is your database username
[password] – this is the password for your database
[databasename] – the name of your database
[backupfile.sql] – the file to which the backup should be written.

Output file (databasedump) will be in “backup” folder

Mysql Database restore

shell>mysql - u username -p databasename < backup.sql
then give password

If your database already exists

shell>mysqlimport -u username -p databasename backup.sql
then give password

How to set WRG permission to a folder recursively

shell>chmod -R 777 directoryname

How to compress or zip a directory 
shell>tar -zcvf backup/12-11-2010.tar.gz foldername/
  • -z: Compress archive using gzip program
  • -c: Create archive
  • -v: Verbose i.e display progress while creating archive
  • -f: Archive File name
shell>tar -zxvf backup/12-11-2010.tar.gz foldername/
  • -x: Extract

Advanced linux commands

shell>df -i

This will return the disc statistics

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda3            59736064  104526 59631538    1% /
/dev/sda1              26104      41   26063    1% /boot
tmpfs                 217771       1  217770    1% /dev/shm


me : yeay its me arun

Tagged with: , , , , , , , , , , , , ,

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.