The top of most important Unix commands…
To learn Unix isn’t too simple idea, so let’s consider the most important unix commands:
- cd - Change directory, example:
cd /etc/ - ls - List directory, example:
ls /etc,usels -l /etcto see more detail - cp - Copy a file or directory, example:
cp source destif you want to copy a directory use the -R option for recursive:cp -R /source /dest - mv - Move a file, example:
mv source dest - rm - Remove a file, example:
rm somefileto remove a directory you may need the -R option, you can also use the -f option which tells it not to confirm each file:rm -rf /dir - cat - Concatenate, or output a file
cat /var/log/messages - tar - Archiver. Usage example:
gunzip -d archive.tar.gz- makes from archive.tar.gz => archive.tar
tar xvf archive.tar- this will extract archive.tar to current directory. - vi - Text editor, example:
vi ./file.txt
To edit a line pressEsc ithen to save changes and exit useEsc wq, or to quit without saving useEsc q!. - man - Show manual for a command, example:
man lshitqto exit the man page. - top - This command provides a good overview of things including CPU and memory utilization, and a list of the top consumers of CPU. If you want to kill some process press “K” and enter id of process.
- wget - Download something frm other server. Example: wget http://www.shopzz.org/robots.txt
How to make backup of MySQL?
mysqldump -u<username> -h<hostname> -p<password> dbname | gzip -9 > dump-db.sql.gz
To import MySQL dump use this:
mysql -u<username> -p<password> dbname < dump-db.sql
Tags: Unix, mysql import, mysqldump, unix, unix commands