Linux常用指令01
阿新 • • 發佈:2018-11-27
yum install 預設安裝位置: #yum install redis [[email protected] etc]# rpm -qa | grep redis redis-3.2.12-1.el7.x86_64 [[email protected] etc]# rpm -ql redis-3.2.12-1.el7.x86_64 /etc/logrotate.d/redis /etc/redis-sentinel.conf /etc/redis.conf /etc/systemd/system/redis-sentinel.service.d /etc/systemd/system/redis-sentinel.service.d/limit.conf /etc/systemd/system/redis.service.d /etc/systemd/system/redis.service.d/limit.conf /usr/bin/redis-benchmark /usr/bin/redis-check-aof /usr/bin/redis-check-rdb /usr/bin/redis-cli /usr/bin/redis-sentinel /usr/bin/redis-server /usr/lib/systemd/system/redis-sentinel.service /usr/lib/systemd/system/redis.service /usr/libexec/redis-shutdown /usr/share/doc/redis-3.2.12 /usr/share/doc/redis-3.2.12/00-RELEASENOTES /usr/share/doc/redis-3.2.12/BUGS /usr/share/doc/redis-3.2.12/CONTRIBUTING /usr/share/doc/redis-3.2.12/MANIFESTO /usr/share/doc/redis-3.2.12/README.md /usr/share/licenses/redis-3.2.12 /usr/share/licenses/redis-3.2.12/COPYING /usr/share/man/man1/redis-benchmark.1.gz /usr/share/man/man1/redis-check-aof.1.gz /usr/share/man/man1/redis-check-rdb.1.gz /usr/share/man/man1/redis-cli.1.gz /usr/share/man/man1/redis-sentinel.1.gz /usr/share/man/man1/redis-server.1.gz /usr/share/man/man5/redis-sentinel.conf.5.gz /usr/share/man/man5/redis.conf.5.gz /var/lib/redis /var/log/redis /var/run/redis 如此就找到了預設的安裝位置了 ==================================== 刪除0Kb的檔案 #找出當前目錄[3KB,10KB]大小的檔案 find ./ -size +3k -a -size -10k #找出當前目錄大於1個位元組的檔案 find ./ -size +1c #找出當前目錄0位元組的檔案 find ./ -size 0c #刪除當前目錄0位元組的檔案 rm -rf `find ./ -size 0c` --------------------- 刪除n天前的所有目錄和檔案 find /gpfspoc/data/ -maxdepth 2 -type d -mtime +5 | xargs rm -rf find /gpfstest/data/ -maxdepth 2 -type d -mtime +5 | xargs rm -rf find ./ -maxdepth 2 -type d -mtime +5 -exec rm -rf {} find /gpfspoc/data/ -maxdepth 2 -type d -mtime +5 -delete //快速刪除10天前的檔案 rsync --delete-before -d /tmp/blank/ ./103143/ rsync --delete-before -d /tmp/blank/ ./110650/ rsync --delete-before -d /tmp/blank/ ./114639/ rsync --delete-before -d -a -H -v --progress --stats /tmp/blank/ /gpfspoc/data/998/ rsync --delete-before -d -a -H -v --progress --stats /tmp/blank/ /gpfstest/data/112550/ 刪除空資料夾: find ./ -type d -empty -delete 刪除空檔案 find ./ -name "*" -type f -size 0c | xargs -n 1 rm -f Ubuntu 檢視已經安裝的軟體: apt list --installed dpkg -l | grep xxx 檢視cent os已經安裝的檔案 [[email protected] home]# rpm -qa | grep quota 判斷Linux系統的髮型版本: lsb_release -a 檢測網路流量: sar -n DEV 5 20 檢測磁碟速度: iostat -d -m -x 2 100 檢視記憶體使用情況 free -m 系統配置:sysctl -a | grep vm cat /proc/meminfo slabtop 檢視slab使用情況