2013年6月13日 星期四

Linux常用指令

shutdown / reboot , reference from 鳥哥

重起sendmail
service sendmail stop
service sendmail start


重起apache

apache reset
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start


掛上一個裝置

mount -t ext3 /dev/sdb1 /mnt/data2
rm -rf *   刪除,recursive & force
cp -rf * ../data2  複製,recursive & force
fg

symboic link
ln -sf /mnt/data2 /mnt/db_disk
$ ln [參數] 來源檔案或資料夾 要建立的 link 名稱
沒有參數的時候是建立 hard link,沒辦法跨 file system,沒辦法 link directory
-s : symbolic link
-f : 要建立的 link 如果存在,會先移除掉再建立

[root@www ~]# ln -s /etc/crontab crontab2
[root@www ~]# ll -i /etc/crontab /root/crontab2
1912701 -rw-r--r-- 2 root root 255 Jan  6  2007 /etc/crontab
 654687 lrwxrwxrwx 1 root root  12 Oct 22 13:58 /root/crontab2 -> /etc/crontab

rm db_disk
umount /mnt/data
若是busy請離開/mnt/data工作目錄

要複製資料且保留權限要使用
tar cvf * -R
tar xvf 

SFTP to non port 22

注意: -oPort 參數要在前面,以避免某些程式解命令列參數時解錯。
解法範例:
sftp -oPort=6789 jjdai@example.com

沒有留言: