Using SSH to login to the Linux shell presents you with a range of very effective tools that you do not find in, for example Windows. Here comes a list of convenient commands:
Change directory: cd /home/username/www
List content of directory: ll
Show size of each directory in current directory: du -sh ./*
Remove file by force: rm -f filename
Remove directory by force: rm -rf ./directory/
Move file: mv fromfile tofile
Copy file: cp fromfile tofile
Importing a database from another database. Can be used with the -h flag to import from a remote host:
mysqldump -uCopyToUser -p localPassword –opt –compress CopyToDb | mysql -uCopyFromUsername -p copyFromPassword CopyFromDb
Compress the folder public_html into a file named archive.tar.gz:
tar -zcvf archive.tar.gz ./public_html/
Synchronize the new changes made in the remote directory /home/username/ to our local direcotry with the same path:
rsync -r username@hostnameOrIp.info:/home/username/ /home/username/
List all directories/files which are 0 to 999 Mb in size:
du -sh ./* | grep [0-9]M
Show content of file: less filename (press q to quit)
Show current processes running on server: top (press q to quit)
Find code standard deviance using code sniffer: phpcs –report=source –standard=Zend ./filename.php
Output codesniffer result for all php files in www directory to text file:
phpcs –standard=Pear /home/username/www/*.php > /home/jean/www/tests/codesniffer.txt
Check for duplicate lines: phpcpd /home/jean/www/ > /home/jean/www/tests/phpcpd.txt
Create HTML report of how messy the code is using PHPMD (mess detector) and put the report in the file phpmd.html:
phpmd /home/jean/www/ html codesize > /home/jean/www/tests/phpmd.html
Read more at http://phpmd.org/documentation/index.html
Download files from ftp:
wget -nc -r ftp://username: password @litebreeze.com/public_html/
1) Select which dir to download by supplying right path by appending dir name after public_html
2) It will download to the current directory, so you need to move into the right directory.