Linux实用命令有哪些

发布时间:2021-10-25 10:04:59 作者:小新
来源:亿速云 阅读:149

这篇文章给大家分享的是有关Linux实用命令有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

1. bc

这个Linux命令用于精度比较高的数学运算。如:开平方根等。下面利用bc命令写个脚本(文件名:sqrt)

#!/bin/bash if [ $ then     echo 'Usage: sqrt number'     exit 1 else     echo -e "sqrt($1)\nquit\n" | bc -q -i fi

接着,可使用这个脚本进行平方根运算:

[hchen@RHELSVR5]$ ./sqrt 36 6 [hchen@RHELSVR5]$ ./sqrt 2.0000 1.4142 [hchen@RHELSVR5]$ ./sqrt 10.0000 3.1622

2. split

如果你的文件很大,却接到命令要把它分割成小文件,那么这个命令就派上用场了。

[hchen@RHELSVR5 applebak]# ls -l largefile.tar.gz -rw-r--r-- 1 hchen hchen 436774774 04-17 02:00 largefile.tar.gz [hchen@RHELSVR5 applebak]# split -b 50m largefile.tar.gz LF_ [hchen@RHELSVR5]# ls -l LF_* -rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_aa -rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ab -rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ac -rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ad -rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ae -rw-r--r-- 1 hchen hchen 52428800 05-10 18:35 LF_af -rw-r--r-- 1 hchen hchen 52428800 05-10 18:35 LF_ag -rw-r--r-- 1 hchen hchen 52428800 05-10 18:35 LF_ah -rw-r--r-- 1 hchen hchen 17344374 05-10 18:35 LF_ai

反而来,合并也只需要简单的合并就行,如:

[hchen@RHELSVR5]# cat LF_* >largefile.tar.gz

3. pgrep

pgrep名字前有个p,可以猜想它可能和grep有关,确实这是进程相关的grep命令。不过,这个命令主要是用来列举进程ID的。如:

$ pgrep -u hchen 22441 22444

这个命令相当于:

ps -ef | egrep '^hchen' | awk '{print $2}'

4. nl

nl命令其它和cat命令很像,只不过它会打上行号。如下所示:

[hchen@RHELSVR5 include]# nl stdio.h | head -n 10      1  /* Define ISO C stdio on top of C++ iostreams.      2     Copyright (C) 1991,1994-2004,2005,2006 Free Software Foundation, Inc.      3     This file is part of the GNU C Library.      4     The GNU C Library is free software; you can redistribute it and/or      5     modify it under the terms of the GNU Lesser General Public      6     License as published by the Free Software Foundation; either      7     version 2.1 of the License, or (at your option) any later version.      8     The GNU C Library is distributed in the hope that it will be useful,

5. ldd

这个命令,用来可执行文件所使用了动态链接库。如:

[hchen@RHELSVR5 ~]# ldd /usr/bin/java         linux-gate.so.1 => (0x00cd9000)         libgij.so.7rh => /usr/lib/libgij.so.7rh (0x00ed3000)         libgcj.so.7rh => /usr/lib/libgcj.so.7rh (0x00ed6000)         libpthread.so.0 => /lib/i686/nosegneg/libpthread.so.0 (0x00110000)         librt.so.1 => /lib/i686/nosegneg/librt.so.1 (0x009c8000)         libdl.so.2 => /lib/libdl.so.2 (0x008b5000)         libz.so.1 => /usr/lib/libz.so.1 (0x00bee000)         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00aa7000)         libc.so.6 => /lib/i686/nosegneg/libc.so.6 (0x0022f000)         libm.so.6 => /lib/i686/nosegneg/libm.so.6 (0x00127000)         /lib/ld-linux.so.2 (0x00214000)

6. col

这个命令,能将man文件转成纯文本文件。如下示例:

# PAGER=cat # man less | col -b > less.txt

感谢各位的阅读!关于“Linux实用命令有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

推荐阅读:
  1. linux运维实用的命令有哪些
  2. 比较实用的Linux命令有哪些

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux

上一篇:在Linux命令行中使用计算器的命令有哪些

下一篇:Python爬虫经常会被封的原因是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》