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

linux 常用的50个命令及例子

11. 文件操作:xargs

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

Default

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

1

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

打包所有的jgp.

Default

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

1

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

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

Default

# cat url-list.txt | xargs wget –c

1

# cat url-list.txt | xargs wget –c

12. 文件信息:ls

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

Default

$ ls -lh

-rw-r----- 1 ramesh team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz

1

2

$ls-lh

-rw-r-----1rameshteam-dev8.9MJun1215:27arch-linux.txt.gz

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

Default

$ ls -ltr

1

$ls-ltr

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

Default

$ ls -F

1

$ls-F

13. 当前路径:pwd

打印当前路径

14. 目录切换命令:cd

“cd -” 返回上一个目录

15. 压缩命令:gzip

创建一个gz文件:

Default

$ gzip test.txt

1

$gziptest.txt

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

Default

$ gzip -d test.txt.gz

1

$gzip-dtest.txt.gz

显示压缩率: gzip -l

Default

$ gzip -l *.gz

compressed uncompressed ratio uncompressed_name

23709 97975 75.8% asp-patch-rpms.txt

1

2

3

$gzip-l *.gz

compresseduncompressedratiouncompressed_name

237099797575.8%asp-patch-rpms.txt

16. 压缩命令:bzip2

创建:file:

Default

$ bzip2 test.txt

1

$bzip2test.txt

解压: *.bz2 file:

Default

bzip2 -d test.txt.bz2

1

bzip2-dtest.txt.bz2

17. 解压命令:unzip

解压一个文件:

Default

$ unzip test.zip

1

$unziptest.zip

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

Default

$ unzip -l jasper.zip

Archive: jasper.zip

Length Date Time Name

-------- ---- ---- ----

40995 11-30-98 23:50 META-INF/MANIFEST.MF

32169 08-25-98 21:07 classes_

15964 08-25-98 21:07 classes_names

10542 08-25-98 21:07 classes_ncomp

1

2

3

4

5

6

7

8

$unzip-ljasper.zip

Archive:jasper.zip

LengthDateTimeName

--------------------

4099511-30-9823:50META-INF/MANIFEST.MF

3216908-25-9821:07classes_

1596408-25-9821:07classes_names

1054208-25-9821:07classes_ncomp

18. 关机命令:shutdown

马上关机.

Default

# shutdown -h now

1

# shutdown -h now

10分钟后关机.

Default

# shutdown -h +10

1

# shutdown -h +10

重启系统马上.

Default

# shutdown -r now

1

# shutdown -r now

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

Default

# shutdown -Fr now

1

# shutdown -Fr now

19. FTP命令

登陆ftp并下载文件

Default

$ ftp IP/hostname

ftp> mget *.html

1

2

$ftpIP/hostname

ftp>mget *.html

查看ftp目录下的文件

Default

ftp> mls *.html -

/ftptest/features.html

/ftptest/index.html

/ftptest/othertools.html

/ftptest/samplereport.html

/ftptest/usage.html

1

2

3

4

5

6

ftp>mls *.html-

/ftptest/features.html

/ftptest/index.html

/ftptest/othertools.html

/ftptest/samplereport.html

/ftptest/usage.html

20. 计划任务crontab

查看某用户的计划任务

Default

# crontab -u john -l

1

# crontab -u john -l

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

Default

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

1

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值