文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>linux命令技巧

linux命令技巧

时间:2010-09-20  来源:smallhonker

1.我想看看某个用户每条命令的执行时间,用history可以吗?
--------------------
不行。除非你當初有設定 HISTTIMEFORMAT 變量,告知要紀錄的時間格式欄位,要不然已經來不及了。
#vi /etc/profile.
.
HISTTIMEFORMAT="%D %H:%M:%S ".
.
保存后重新登陆查看。

2. 下面的例子可以把/etc的结构复制到当前位置(不要内容,只要目录结构):
------------------------------
find /etc -type d  |awk -F '/etc/' '{print $2}' |xargs mkdir -p
  2.1
统计文件 find yourpath -type f | wc -l
统计目录 find yourpath -type d | wc -l
  3. 如何备份指定的文件类型?
---------------------
备份/usr 下所有的*.c 文件到/root/c.cpio文件
#find /usr -name *.c | cpio -ov -F /root/c.cpio

---------------------
备份指定目录下的文件到指定目录:
源目录为:/home/a
目标目录为:/home/b
find /home/a -name *.txt | cpio -pd /home/b

4.
远程MOUNT主机文件?
------------------
#mount 192.168.1.246:/netinstall/centos4 /media/file

5.
排列目录下的文件

从小到大
#ls -lSr

从大到小
#ls -lSu

从新到旧
#ls -lt

------------
# man ls |grep sort
       -c     with -lt: sort by, and show, ctime (time of last modification of
              file status information) with -l: show ctime and  sort  by  name
              otherwise: sort by ctime
       -f     do not sort, enable -aU, disable -lst
              reverse order while sorting
       -S     sort by file size
              access,  use, ctime or status; use specified time as sort key if
       -t     sort by modification time
       -u     with -lt: sort by, and show, access time with  -l:  show  access
              time and sort by name otherwise: sort by access time
       -U     do not sort; list entries in directory order
       -v     sort by version
       -X     sort alphabetically by entry extension

相关阅读 更多 +
排行榜 更多 +
猎枪行动

猎枪行动

飞行射击 下载
导弹袭击

导弹袭击

飞行射击 下载
猫猫突围封锁要塞新手打法

猫猫突围封锁要塞新手打法

飞行射击 下载