Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

LINUX 常用的50个命令及例子11~20

$
0
0
linux 常用的50个命令及例子 11. 文件操作:xargs

把所有的jpg拷贝到另外的目录下

# ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory

打包所有的jgp.

# find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz

下载文件列表中的所有文件

# cat url-list.txt | xargs wget c 12. 文件信息:ls

用一种人类可读的方式显示问文件信息

$ ls -lh -rw-r----- 1 rameshteam-dev 8.9M Jun 12 15:27 arch-linux.txt.gz

按照文件的最后修改时间排序:

$ ls -ltr

显示当前文件夹下所有的文件(并在文件夹的后边的追加/ , 用于区分)

$ ls -F 13. 当前路径:pwd

打印当前路径

14. 目录切换命令:cd

“cd -” 返回上一个目录

15. 压缩命令:gzip

创建一个gz文件:

$ gziptest.txt

解压一个文件a *.gz file:

$ gzip -d test.txt.gz

显示压缩率: gzip -l

$ gzip -l *.gz compresseduncompressedratiouncompressed_name 237099797575.8% asp-patch-rpms.txt 16. 压缩命令:bzip2

创建:file:

$ bzip2test.txt

解压: *.bz2 file:

bzip2 -d test.txt.bz2 17. 解压命令:unzip

解压一个文件:

$ unziptest.zip

在不解压的情况下查看压缩文件内容:

$ unzip -l jasper.zip Archive:jasper.zip LengthDateTimeName -------------------- 4099511-30-98 23:50META-INF/MANIFEST.MF 3216908-25-98 21:07classes_ 1596408-25-98 21:07classes_names 1054208-25-98 21:07classes_ncomp 18. 关机命令:shutdown

马上关机.

# shutdown -h now

10分钟后关机.

# shutdown -h +10

重启系统马上.

# shutdown -r now

强制在重启过程中文件检查.

# shutdown -Fr now 19. FTP命令

登陆ftp并下载文件

$ ftpIP/hostname ftp> mget *.html

查看ftp目录下的文件

ftp> mls *.html - /ftptest/features.html /ftptest/index.html /ftptest/othertools.html /ftptest/samplereport.html /ftptest/usage.html 20. 计划任务crontab

查看某用户的计划任务

# crontab -u john -l

增加一个新的计划任务(crontab -e).

*/10 * * * * /home/ramesh/check-disk-space


Viewing all articles
Browse latest Browse all 11063

Trending Articles