Linux小知識點彙總

 

 
一、crontab 
 
(1)crontab每10秒執行一次 
* * * * * /bin/date >>/tmp/date.txt 
* * * * * sleep 10; /bin/date >>/tmp/date.txt 
(2)還能夠用如下方式表達 

string            meaning  
------           -------  
@reboot        Run once, at startup.  
@yearly         Run once a year,  " 0 0 1 1 * ".  
@annually      (same as  @yearly)  
@monthly       Run once a month,  " 0 0 1 * * ".  
@weekly        Run once a week,  " 0 0 * * 0 ".  
@daily           Run once a day,  " 0 0 * * * ".  
@midnight      (same as  @daily)  
@hourly         Run once an hour,  " 0 * * * * java

 
 
二、踢用戶下線  
root@iZ94hgp4s2xZ:~# w 
 10:15:27 up 1 day, 19:20,  2 users,  load average: 0.00, 0.01, 0.05 
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT 
jediael  pts/0    218.107.55.252   09:15   31.00s  0.13s  0.13s -bash 
root     pts/1    218.107.55.252   10:15    1.00s  0.02s  0.00s w 
root@iZ94hgp4s2xZ:~# pkill -kill -t pts/0 
 
三、關於幾個bin目錄 
/bin:與開機相關的命令,包括單用戶模式時用於系統的修復  如 cp mv bash dmsg grep chmod 
/sbin:同上,且通常是容許root使用 如 init iptables lvm 
/usr/bin:與開機無關的命令  java tail gcc  
/usr/sbin:同上,通常root使用的命令 useradd usermod 
/usr/local/bin:當同一軟件須要不一樣版本,但又不想刪除原有版本時,就將新軟件安裝在這裏 
/user/local/sbin:同上,通常root使用的命令 
 
四、在proc文件系統中查看內存及cpu信息 
cat /proc/cpuinfo 
cat /proc/meminfo 
 
 
五、一些經常使用命令及選項 
cat /etc/passwd | cut -d ':' -f 1 
apt-cache dumpavail | grep  'Package: mysql’ 
cat /etc/passwd | sort -t ':' -k 3 -n 
last | cut -d ' ' -f 1 | sort | uniq -c 
 

六、磁盤分區基本步驟
(1)建立分區 fdisk
(2)格式化分區 mkfs
(3)磁盤檢查 fsck
(4)磁盤掛載 mount

七、關於apt經常使用命令
(1)安裝
apt-get  install scala
(2)指定某個版本
apt-get install calla=2.9.2
(3)刪除某個軟件
apt-get remove scala
(4)查找某個軟件
apt-cache search scala
相關文章
相關標籤/搜索