linux commands for every web developer/Software engineer
scp – Linux command line tool to copy files over ssh
scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]
scp abc.TXT root@10.215.3.150:/home/user/xyz.TXT
- from-host
- Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
- user
- Is the user which have the right to access the file and directory that is supposed to be copied in the cas of the from-host and the user who has the rights to write in the to-host
- source-file
- Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory
- destination-file
- Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to maintain its names
Copy Multiple fies
scp root@192.168.168.052:/home/ftp-124/5656/$dir/\{abc.txt,def.txt,ghi.txt\} root@192.168.168.053:/home/shahzeb
Restart MySql Ubuntu
To restart Apache2 on Ubuntu, we enter the following command in a terminal such as bash:
restart mysql
service mysql start
Restart Apache2 Ubuntu
To restart Apache2 on Ubuntu, we enter the following command in a terminal such as bash:
/etc/init.d/apache2 restart
Of course, you most likely will need to be the superuser to do that so you might need to enter the following command and then your password when requested:
sudo /etc/init.d/apache2 restart
Pointer
use pointer to acees the variable within a variable directly like
foo=bar
name=foo
echo ${!name}
Result : bar
grep command:
grep command usually interpet “|” as “AND” sign but you can use the same “|” for “OR” sign
for example
zgrep “^2012-06-05” /var/path/to/file/abc12346-12-06* | grep -E ‘3003300356|3003301763|3008203898|3008202542|3008226266|3003404159’