您的位置:首页 > 运维架构 > Linux

Linux 新手非常有用的命令

2015-03-16 14:30 246 查看
你打算从Windows换到Linux上来,还是你刚好换到Linux上来?哎哟!!!我说什么呢,是什么原因你就出现我的世界里了。

从我以往的经验来说,当我刚使用Linux,命令,终端啊什么的,吓了我一跳。我担心该记住多少命令,来帮助我完成所有任务。

毫无疑问,在线文档,书籍,man pages以及社区帮了我一个大忙,但是我还是坚信有那么一篇文章记录了如何简单学习和理解命令的秘籍。

这激发了我掌握Linux和使它容易使用的积极性。本文就是通往那里的阶梯。

1. ls命令

ls命令是列出目录内容(List Directory Contents)的意思。运行它就是列出文件夹里的内容,可能是文件也可能是文件夹。

1

2

3

4

5

6

7

root@tecmint:~# ls


Android-Games Music


Pictures  Public


Desktop   Tecmint.com


Documents TecMint-Sync


Downloads Templates


“ls -l”命令已详情模式(long listing fashion)列出文件夹的内容。

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~# ls -l


total40588


drwxrwxr-x 2ravisaive ravisaive4096 May 8 01:06 Android Games


drwxr-xr-x 2ravisaive ravisaive4096 May1510:50 Desktop


drwxr-xr-x 2ravisaive ravisaive4096 May1616:45 Documents


drwxr-xr-x 6 ravisaive ravisaive4096 May1614:34 Downloads


drwxr-xr-x 2ravisaive ravisaive4096 Apr 30 20:50 Music


drwxr-xr-x 2ravisaive ravisaive4096 May  917:54 Pictures


drwxrwxr-x 5 ravisaive ravisaive4096 May  318:44 Tecmint.com


drwxr-xr-x 2ravisaive ravisaive4096 Apr 30 20:50 Templates


“ls -a”命令会列出文件夹里的所有内容,包括以”.”开头的隐藏文件。

1

2

3

4

5

6

7

8

9

10

11

12

root@tecmint:~# ls -a


.   .gnupg  .dbus   .goutputstream-PI5VVW   .mission-control


.adobe  deja-dup.grsync.mozilla.themes


.gstreamer-0.10 .mtpaint.thumbnails .gtk-bookmarks  .thunderbird


.HotShots   .mysql_history  .htaccess   .apport-ignore.xml  .ICEauthority


.profile.bash_history   .icons  .bash_logout.fbmessenger


.jedit  .pulse  .bashrc.liferea_1.8.pulse-cookie


.Xauthority .gconf  .local
.Xauthority.HGHVWW  .cache


.gftp   .macromedia.remmina.cinnamon   .gimp-2.8


.ssh
.xsession-errors.compiz .gnome  teamviewer_linux.deb


.xsession-errors.old.config .gnome2.zoncolor


注意:在Linux中,文件以“.”开头的就是隐藏文件,并且每个文件,文件夹,设备或者命令都是以文件对待。ls -l 命令输出:

d (代表了是目录).

rwxr-xr-x 是文件或者目录对所属用户,同一组用户和其它用户的权限。

上面例子中第一个ravisaive 代表了文件文件属于用户ravisaive

上面例子中的第二个ravisaive代表了文件文件属于用户组ravisaive

4096 代表了文件大小为4096字节.

May8 01:06 代表了文件最后一次修改的日期和时间.

最后面的就是文件/文件夹的名字

更多”ls”例子请查看 15 linux中ls命令实例

2. lsblk命令

“lsblk”就是列出块设备。除了RAM外,以标准的树状输出格式,整齐地显示块设备。

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~# lsblk


NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT


sda8:00 232.9G  0 disk


├─sda1 8:10 46.6G  0 part /


├─sda2 8:201K  0 part


├─sda5  8:50  190M  0 part /boot


├─sda6  8:60   3.7G  0 part [SWAP]


├─sda7  8:70  93.1G  0 part /data


└─sda8  8:80 89.2G  0 part /personal


sr011:0   11024M  0 rom


“lsblk -l”命令以列表格式显示块设备(而不是树状格式)。

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~# lsblk -l


NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT


sda  8:00 232.9G  0 disk


sda1 8:10 46.6G  0 part /


sda2 8:201K  0 part


sda5  8:50  190M  0 part /boot


sda6  8:60   3.7G  0 part [SWAP]


sda7  8:70  93.1G  0 part /data


sda8  8:80 89.2G  0 part /personal


sr0  11:0   11024M  0 rom


注意:lsblk是最有用和最简单的方式来了解新插入的USB设备的名字,特别是当你在终端上处理磁盘/块设备时。

3. md5sum命令

“md5sum”就是计算和检验MD5信息签名。md5 checksum(通常叫做哈希)使用匹配或者验证文件的文件的完整性,因为文件可能因为传输错误,

磁盘错误或者无恶意的干扰等原因而发生改变。

1

2

3

root@tecmint:~# md5sum teamviewer_linux.deb


47790ed345a7b7970fc1f2ac50c97002 teamviewer_linux.deb


注意:用户可以使用官方提供的和md5sum生成签名信息匹对以此检测文件是否改变。Md5sum没有sha1sum安全,这点我们稍后讨论。

4. dd命令

“dd”命令代表了转换和复制文件。可以用来转换和复制文件,大多数时间是用来复制iso文件(或任何其它文件)到一个usb设备(或任何其它地方)中去,

所以可以用来制作USB启动器。

1

root@tecmint:~# dd if=/home/user/Downloads/debian.iso of=/dev/sdb1bs=512M; sync


注意:在上面的例子中,usb设备就是sdb1(你应该使用lsblk命令验证它,否则你会重写你的磁盘或者系统),请慎重使用磁盘的名,切忌。

dd 命令在执行中会根据文件的大小和类型 以及 usb设备的读写速度,消耗几秒到几分钟不等。

5. uname命令

“uname”命令就是Unix Name的简写。显示机器名,操作系统和内核的详细信息。

1

2

3

root@tecmint:~# uname -a


Linux tecmint 3.8.0-19-generic#30-Ubuntu SMP Wed May116:36:13 UTC 2013 i686 i686 i686 GNU/Linux


注意: uname显示内核类别, uname -a显示详细信息。上面的输出详细说明了uname -a

“Linux“: 机器的内核名

“tecmint“: 机器的分支名

“3.8.0-19-generic“: 内核发布版本

“#30-Ubuntu SMP“: 内核版本

“i686“: 处理器架构

“GNU/Linux“: 操作系统名

6. history命令

“history”命令就是历史记录。它显示了在终端中所执行过的所有命令的历史。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

root@tecmint:~# history


1 sudo
add-apt-repository ppa:tualatrix/ppa


2 sudo
apt-get update


3  sudo
apt-get install
ubuntu-tweak


4  sudo
add-apt-repository ppa:diesch/testing


5  sudo
apt-get update


6  sudo
apt-get install
indicator-privacy


7  sudo
add-apt-repository ppa:atareao/atareao


8  sudo
apt-get update


9  sudo
apt-get install
my-weather-indicator


10 pwd


11cd
&& sudo
cp
-r unity/6
/usr/share/unity/


12cd
/usr/share/unity/icons/


13 cd
/usr/share/unity


注意:按住“CTRL + R”就可以搜索已经执行过的命令,它可以你写命令时自动补全。

1

(reverse-i-search)`if': ifconfig


7. sudo命令

“sudo”(super user do)命令允许授权用户执行超级用户或者其它用户的命令。通过在sudoers列表的安全策略来指定。

1

root@tecmint:~# sudo add-apt-repository ppa:tualatrix/ppa


注意:sudo 允许用户借用超级用户的权限,然而”su”命令实际上是允许用户以超级用户登录。所以sudo比su更安全。

并不建议使用sudo或者su来处理日常用途,因为它可能导致严重的错误如果你意外的做错了事,这就是为什么在linux社区流行一句话:

“To err is human, but to
really foul up everything, you need root password.”

“人非圣贤孰能无过,但是拥有root密码就真的万劫不复了。”

8. mkdir命令

“mkdir”(Make directory)命令在命名路径下创建新的目录。然而如果目录已经存在了,那么它就会返回一个错误信息”不能创建文件夹,

文件夹已经存在了”(“cannot
create folder, folder already exists”)

1

root@tecmint:~#
mkdir tecmint


注意:目录只能在用户拥有写权限的目录下才能创建。mkdir:不能创建目录`tecmint`,因为文件已经存在了。

(上面的输出中不要被文件迷惑了,你应该记住我开头所说的-在linux中,文件,文件夹,驱动,命令,脚本都视为文件)

9. touch 命令

“touch”命令代表了将文件的访问和修改时间更新为当前时间。touch命令只会在文件不存在的时候才会创建它。如果文件已经存在了,

它会更新时间戳,但是并不会改变文件的内容。

1

root@tecmint:~#
touch tecmintfile


注意:touch 可以用来在用户拥有写权限的目录下创建不存在的文件。

10. chmod 命令

“chmod”命令就是改变文件的模式位。chmod会根据要求的模式来改变每个所给的文件,文件夹,脚本等等的文件模式(权限)。

在文件(文件夹或者其它,为了简单起见,我们就使用文件)中存在3中类型的权限

1

2

3

Read (r)=4


Write(w)=2


Execute(x)=1


所以如果你想给文件只读权限,就设置为’4′;只写权限,设置权限为’2′;只执行权限,设置为1; 读写权限,就是4+2=
6, 以此类推。

现在需要设置3种用户和用户组权限。第一个是拥有者,然后是用户所在的组,最后是其它用户。

1

rwxr-x--x
abc.sh


这里root的权限是 rwx读写和执行权限),

  所属用户组权限是 r-x (只有读写权限, 没有写权限)

  对于其它用户权限是 -x(只有只执行权限)

为了改变它的权限,为拥有者,用户所在组和其它用户提供读,写,执行权限。

1

root@tecmint:~#
chmod 777 abc.sh


三种都只有读写权限

1

root@tecmint:~#
chmod 666 abc.sh


拥有者用户有读写和执行权限,用户所在的组和其它用户只有可执行权限

1

root@tecmint:~#
chmod 711abc.sh


注意:对于系统管理员和用户来说,这个命令是最有用的命令之一了。在多用户环境或者服务器上,对于某个用户,如果设置了文件不可访问,

那么这个命令就可以解决,如果设置了错误的权限,那么也就提供了为授权的访问。

11. chown命令

“chown”命令就是改变文件拥有者和所在用户组。每个文件都属于一个用户组和一个用户。在你的目录下,使用”ls
-l”,你就会看到像这样的东西。

1

2

3

4

root@tecmint:~#
ls -l


drwxr-xr-x
3 server root4096 May1011:14 Binary


drwxr-xr-x
2server server4096 May13 09:42Desktop


在这里,目录Binary属于用户”server”,和用户组”root”,而目录”Desktop”属于用户“server”和用户组”server”

“chown”命令用来改变文件的所有权,所以仅仅用来管理和提供文件的用户和用户组授权。

1

2

3

4

root@tecmint:~#
chown server:server Binary


drwxr-xr-x
3
server server4096
May10
11:14
Binary


drwxr-xr-x
2
server server4096
May13
09:42
Desktop


注意:“chown”所给的文件改变用户和组的所有权到新的拥有者或者已经存在的用户或者用户组。

12. apt命令

Debian系列以“apt”命令为基础,“apt”代表了Advanced
Package Tool。

APT是一个为Debian系列系统(Ubuntu,Kubuntu等等)开发的高级包管理器,

在Gnu/Linux系统上,它会为包自动地,智能地搜索,安装,升级以及解决依赖。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

root@tecmint:~#
apt-get install mplayer


Reading
package lists... Done


Building
dependency tree


Reading
state information... Done


The following
package was automatically installed and is no longer required:


java-wrappers


Use
'apt-get autoremove'
to remove it.


The
following extrapackages will be installed:


esound-common
libaudiofile1libesd0 libopenal-datalibopenal1libsvga1libvdpau1
libxvidcore4


Suggested
packages:


pulseaudio-esound-compat
libroar-compat2nvidia-vdpau-driver vdpau-driver mplayer-docnetselect fping


The
following NEW packages will be installed:


esound-common
libaudiofile1libesd0 libopenal-datalibopenal1libsvga1libvdpau1
libxvidcore4 mplayer


0
upgraded, 9 newly installed, 0 to remove and8 not upgraded.


Need to
get 3,567 kB of archives.


After this
operation, 7,772kB of additional disk space will be used.


Do you
want to continue
[Y/n]? y


1

2

3

4

5

6

7

8

9

10

11

12

13

14

root@tecmint:~#
apt-get update


Hit http://ppa.launchpad.net raring
Release.gpg


Hit http://ppa.launchpad.net raring
Release.gpg


Hit http://ppa.launchpad.net raring
Release.gpg


Hit http://ppa.launchpad.net raring
Release.gpg


Get:1http://security.ubuntu.com raring-security Release.gpg [933 B]


Hit http://in.archive.ubuntu.com raring
Release.gpg


Hit http://ppa.launchpad.net raring
Release.gpg


Get:2http://security.ubuntu.com raring-security Release [40.8 kB]


Ign http://ppa.launchpad.net raring
Release.gpg


Get:3 http://in.archive.ubuntu.com raring-updates Release.gpg [933
B]


Hit http://ppa.launchpad.net raring
Release.gpg


Hit http://in.archive.ubuntu.com raring-backports Release.gpg


注意:上面的命令会导致系统整体的改变,所以需要root密码(查看提示符为”#”,而不是“$”).

和yum命令相比,Apt更高级和智能。

见名知义,apt-cache用来搜索包中是否包含子包mplayer,
apt-get用来安装,升级所有的已安装的包到最新版。

关于apt-get

apt-cache命令更多信息,请查看 25 APT-GET和APT-CACHE命令

13. tar命令

tar”命令是磁带归档(Tape
Archive),对创建一些文件的的归档和它们的解压很有用。

1

root@tecmint:~#
tar -zxvf abc.tar.gz (
记住'z'代表了.tar.gz)


1

root@tecmint:~#
tar -jxvf abc.tar.bz2(
记住'j'代表了.tar.bz2)


1

root@tecmint:~#
tar -cvf archieve.tar.gz(.bz2) /path/to/folder/abc


注意: “tar.gz“代表了使用gzip归档,“bar.bz2”使用bzip压缩的,它压缩的更好但是也更慢。

了解更多”tar 命令”的例子,请查看 18 Tar命名例子

14. cal 命令

“cal”(Calender),它用来显示当前月份或者未来或者过去任何年份中的月份。

1

2

3

4

5

6

7

8

9

root@tecmint:~#
cal


May
2013


Su Mo Tu
We Th Fr Sa


1
2 3 4


5
6  7 8  91011


121314
15161718


19 20 21
2223 24 25


26 27 28
29 30 31


显示已经过去的月份,1835年2月

1

2

3

4

5

6

7

8

root@tecmint:~#
cal02
1835


February
1835


Su Mo Tu
We Th Fr Sa


1
2
3
4
5
6
7


8
9
10
11
12
13
14


15
16
17
18
19
20
21


22
23
24
25
26
27
28


显示未来的月份,2145年7月。

1

2

3

4

5

6

7

8

9

root@tecmint:~#
cal07
2145


July
2145


Su Mo Tu
We Th Fr Sa


1
2
3


4
5
6
7
8
9
10


11
12
13
14
15
16
17


18
19
20
21
22
23
24


25
26
27
28
29
30
31


注意: 你不需要往回调整日历50年,既不用复杂的数据计算你出生那天,也不用计算你的生日在哪天到来,

[因为它的最小单位是月,而不是日]。

15. date命令

“date”命令使用标准的输出打印当前的日期和时间,也可以深入设置。

1

2

3

root@tecmint:~#
date


Fri May17
14:13:29
IST 2013


1

2

3

root@tecmint:~#
date --set='14 may 201313:57'


Mon May13
13:57:00
IST 2013


注意:这个命令在脚本中十分有用,以及基于时间和日期的脚本更完美。而且在终端中改变日期和时间,让你更专业!!!

(当然你需要root权限才能操作这个,因为它是系统整体改变)

16. cat命令

“cat”代表了连结(Concatenation),连接两个或者更多文本文件或者以标准输出形式打印文件的内容。

1

root@tecmint:~#
cat a.txt b.txt c.txt d.txt abcd.txt


1

2

3

4

root@tecmint:~#
cat abcd.txt


....


contents
of file abcd


...


注意:“>>”和“>”调用了追加符号。它们用来追加到文件里,而不是显示在标准输出上。“>”符号会删除已存在的文件,

然后创建一个新的文件。

所以因为安全的原因,建议使用“>>”,它会写入到文件中,而不是覆盖或者删除。

在深入探究之前,我必须让你知道通配符(你应该知道通配符,它出现在大多数电视选秀中)。

通配符是shell的特色,和任何GUI文件管理器相比,

它使命令行更强大有力!如你所看到那样,在一个图形文件管理器中,你想选择一大组文件,你通常不得不使用你的鼠标来选择它们。

这可能觉得很简单,

但是事实上,这种情形很让人沮丧!

例如,假如你有一个有很多很多各种类型的文件和子目录的目录,然后你决定移动所有文件名中包含“Linux”字样的HTML文件到另外一个目录。

如何简单的完成这个?如果目录中包含了大量的不同名的HTML文件,你的任务很巨大,而不是简单了。

在LInux CLI中,这个任务就很简单,就好像只移动一个HTML文件,因为有shell的通配符,才会如此简单。这些是特殊的字符,

允许你选择匹配某种字符模式的文件名。它帮助你来选择,即使是大量文件名中只有几个字符,而且在大多数情形中,

它比使用鼠标选择文件更简单。

这里就是常用通配符列表:

1

2

3

4

5

6

7

8

Wildcard
Matches


*
零个或者更多字符


?
恰好一个字符


[abcde]
恰好列举中的一个字符


[a-e]
恰好在所给范围中的一个字符


[!abcde]
任何字符都不在列举中


[!a-e]
任何字符都不在所给的范围中


{debian,linux}
恰好在所给选项中的一整个单词


! 叫做非,带’!’的反向字符串为真

更多请阅读Linux
cat 命令的实例 13 Linux中cat命令实例

17. cp 命令

“copy”就是复制。它会从一个地方复制一个文件到另外一个地方。

1

root@tecmint:~#
cp /home/user/Downloads abc.tar.gz /home/user/Desktop (Return 0
when
sucess)


注意: cp,在shell脚本中是最常用的一个命令,而且它可以使用通配符(在前面一块中有所描述),来定制所需的文件的复制。

18. mv 命令

“mv”命令将一个地方的文件移动到另外一个地方去。

1

root@tecmint:~#
mv /home/user/Downloads abc.tar.gz /home/user/Desktop (Return 0
when
sucess)


注意:mv 命令可以使用通配符。mv需谨慎使用,因为易懂系统的或者未授权的文件不但会导致安全性问题,而且可能系统崩溃。

19. pwd 命令

“pwd”(print
working directory),在终端中显示当前工作目录的全路径。

1

2

3

root@tecmint:~#
pwd


/home/user/Desktop


注意: 这个命令并不会在脚本中经常使用,但是对于新手,当从连接到nux很久后在终端中迷失了路径,这绝对是救命稻草。

20. cd 命令

最后,经常使用的“cd”命令代表了改变目录。它在终端中改变工作目录来执行,复制,移动,读,写等等操作。

1

root@tecmint:~#
cd /home/user/Desktop


1

2

3

server@localhost:~$
pwd


/home/user/Desktop


注意: 在终端中切换目录时,cd就大显身手了。“cd ~”会改变工作目录为用户的家目录,

而且当用户发现自己在终端中迷失了路径时,非常有用。

“cd
..”从当前工作目录切换到(当前工作目录的)父目录。

这些命令肯定会让你在Linux上很舒服。但是这并不是结束。不久,我就会写一些其它的针对于中级用户的有用命令。

例如,如果你熟练使用这些命令,

欢呼吧,少年,你会发现你已从小白级别提升为了中级用户了。在下篇文章,我会介绍像“kill”,”ps”,”grep”等等命令,

期待吧,我不会让你失望的。

对中级 Linux 用户非常有用的 20 个命令

也许你已经发现第一篇文章非常的有用,这篇文章是继《对初级Linux用户非常有用的20个命令》的一个延伸。

第一篇文章的目的是为新手准备,而这篇文章则是为了Linux的中高级用户。在这里你将学会如何进行自定义搜索,知道正在进行的进程和停掉进程,

如何使用Linux的强势功能和如何在系统内编译C、C++和JAVA程序。

21. 命令: Find

搜索指定目录下的文件,从开始于父目录,然后搜索子目录。

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~#
find -name *.sh


./Desktop/load.sh


./Desktop/test.sh


./Desktop/shutdown.sh


./Binary/firefox/run-mozilla.sh


./Downloads/kdewebdev-3.5.8/quanta/scripts/externalpreview.sh


./Downloads/kdewebdev-3.5.8/admin/doxygen.sh


./Downloads/kdewebdev-3.5.8/admin/cvs.sh


./Downloads/kdewebdev-3.5.8/admin/ltmain.sh


./Downloads/wheezy-nv-install.sh


注意: `-name‘选项是搜索大小写敏感。可以使用`-iname‘选项,这样在搜索中可以忽略大小写。

(*是通配符,可以搜索所有的文件;‘.sh‘你可以使用文件名或者文件名的一部分来制定输出结果)

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~#
find -iname *.SH ( find -iname *.Sh /  find -iname *.sH)


./Desktop/load.sh


./Desktop/test.sh


./Desktop/shutdown.sh


./Binary/firefox/run-mozilla.sh


./Downloads/kdewebdev-3.5.8/quanta/scripts/externalpreview.sh


./Downloads/kdewebdev-3.5.8/admin/doxygen.sh


./Downloads/kdewebdev-3.5.8/admin/cvs.sh


./Downloads/kdewebdev-3.5.8/admin/ltmain.sh


./Downloads/wheezy-nv-install.sh


1

2

3

4

5

6

7

8

9

10

11

12

root@tecmint:~#
find -name *.tar.gz


/var/www/modules/update/tests/aaa_update_test.tar.gz


./var/cache/flashplugin-nonfree/install_flash_player_11_linux.i386.tar.gz


./home/server/Downloads/drupal-7.22.tar.gz


./home/server/Downloads/smtp-7.x-1.0.tar.gz


./home/server/Downloads/noreqnewpass-7.x-1.2.tar.gz


./usr/share/gettext/archive.git.tar.gz


./usr/share/doc/apg/php.tar.gz


./usr/share/doc/festival/examples/speech_pm_1.0.tar.gz


./usr/share/doc/argyll/examples/spyder2.tar.gz


./usr/share/usb_modeswitch/configPack.tar.gz


注意:以上命令查找根目录下和所有文件夹以及加载的设备的子目录下的所有包含‘tar.gz’的文件。

’find’命令的更详细信息请参考35 Find Command Examples in Linux

22. 命令: grep

‘grep‘命令搜索指定文件中包含给定字符串或者单词的行。举例搜索‘/etc/passwd‘文件中的‘tecmint’

1

2

3

root@tecmint:~#
grep tecmint /etc/passwd


tecmint:x:1000:1000:Tecmint,,,:/home/tecmint:/bin/bash


使用’-i’选项将忽略大小写。

1

2

3

root@tecmint:~#
grep -i TECMINT /etc/passwd


tecmint:x:1000:1000:Tecmint,,,:/home/tecmint:/bin/bash


使用’-r’选项递归搜索所有自目录下包含字符串 “127.0.0.1“.的行。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

root@tecmint:~#
grep -r "127.0.0.1" /etc/


/etc/vlc/lua/http/.hosts:127.0.0.1


/etc/speech-dispatcher/modules/ivona.conf:#IvonaServerHost
"127.0.0.1"


/etc/mysql/my.cnf:bind-address
=127.0.0.1


/etc/apache2/mods-available/status.conf:
Allow from127.0.0.1::1


/etc/apache2/mods-available/ldap.conf:
Allow from127.0.0.1::1


/etc/apache2/mods-available/info.conf:
Allow from127.0.0.1::1


/etc/apache2/mods-available/proxy_balancer.conf:#
Allow from127.0.0.1::1


/etc/security/access.conf:#+
: root :127.0.0.1


/etc/dhcp/dhclient.conf:#prepend
domain-name-servers127.0.0.1;


/etc/dhcp/dhclient.conf:#
option domain-name-servers127.0.0.1;


/etc/init/network-interface.conf:
ifconfig lo127.0.0.1up || true


/etc/java-6-openjdk/net.properties:#
localhost &127.0.0.1).


/etc/java-6-openjdk/net.properties:#
http.nonProxyHosts=localhost|127.0.0.1


/etc/java-6-openjdk/net.properties:#
localhost &127.0.0.1).


/etc/java-6-openjdk/net.properties:#
ftp.nonProxyHosts=localhost|127.0.0.1


/etc/hosts:127.0.0.1
localhost


注意:您还可以使用以下选项:

1-w搜索单词 (egrep -w ‘word1|word2‘ /path/to/file).

2-c用于统计满足要求的行 (i.e., total number of times the pattern matched) (grep -c‘word‘ /path/to/file).

3 –color彩色输出 (grep –color server /etc/passwd).

23. 命令: man

‘man‘是系统帮助页。Man提供命令所有选项及用法的在线文档。几乎所有的命令都有它们的帮助页,例如:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

root@tecmint:~#
man man


MAN(1)
Manual pager utils
MAN(1)


NAME


man
- an interface to the on-line reference manuals


SYNOPSIS


man
[-C  file]  [-d]  [-D]  [--warnings[=warnings]]
[-R  encoding]  [-L  locale]  [-m  system[,...]]
[-M  path]  [-S list] [-e extension] [-i|-I]


[--regex|--wildcard]
[--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E
encoding] [--no-hyphenation] [--no-justification]  [-p


string]
[-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...


man
-k [apropos options] regexp ...


man
-K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...


man
-f [whatis options] page ...


man
-l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P
pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]]


[-H[browser]]
[-X[dpi]] [-Z] file ...


man
-w|-W [-C file] [-d] [-D] page ...


man
-c[-C file] [-d] [-D] page ...


man
[-hV]


上面是man命令的系统帮助页,类似的有cat和ls的帮助页。

注意:系统帮助页是为了命令的使用和学习而设计的。

24. 命令: ps

ps命令给出正在运行的某个进程的状态,每个进程有特定的id成为PID。

1

2

3

4

5

root@tecmint:~#
ps


PID
TTY  TIME CMD


4170
pts/100:00:00 bash


9628
pts/100:00:00 ps


使用‘-A‘选项可以列出所有的进程及其PID。

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~#
ps -A


PID
TTY  TIME CMD


   1
?00:00:01init


2
?00:00:00 kthreadd


3
?00:00:01ksoftirqd/0


5
?00:00:00 kworker/0:0H


7
?00:00:00 kworker/u:0H


   8
?00:00:00 migration/0


9
?00:00:00 rcu_bh


....


注意:当你要知道有哪些进程在运行或者需要知道想杀死的进程PID时ps命令很管用。你可以把它与‘grep‘合用来查询指定的输出结果,例如:

1

2

3

4

root@tecmint:~#
ps -A | grep -i ssh


1500
?00:09:58 sshd


4317
?00:00:00 sshd


ps命令与grep命令用管道线分割可以得到我们想要的结果。

25. 命令: kill

也许你从命令的名字已经猜出是做什么的了,kill是用来杀死已经无关紧要或者没有响应的进程.

它是一个非常有用的命令,而不是非常非常有用.

你可能 很熟悉Windows下要杀死进程可能需要频繁重启机器因为一个在运行的进程大部分情况下不能够杀死,

即使杀死了进程也需要重新启动操作系统才能生效.

但 在linux环境下,事情不是这样的.你可以杀死一个进程并且重启它而不是重启整个操作系统.

杀死一个进程需要知道进程的PID.

假设你想杀死已经没有响应的‘apache2′进程,运行如下命令:

1

2

3

root@tecmint:~#
ps -A | grep -i apache2


1285
?00:00:00 apache2


搜索‘apache2′进程,找到PID并杀掉它.例如:在本例中‘apache2′进程的PID是1285..

1

root@tecmint:~#
kill1285 (to kill the process apache2)


注意:每次你重新运行一个进程或者启动系统,每个进程都会生成一个新的PID.你可以使用ps命令获得当前运行进程的PID.

另一个杀死进程的方法是:

1

root@tecmint:~#
pkill apache2


注意:kill需要PID作为参数,pkill可以选择应用的方式,比如指定进程的所有者等.

26. 命令: whereis

whereis的作用是用来定位命令的二进制文件\资源\或者帮助页.举例来说,获得ls和kill命令的二进制文件/资源以及帮助页:

1

2

3

root@tecmint:~#
whereis ls


ls:
/bin/ls /usr/share/man/man1/ls.1.gz


1

2

3

root@tecmint:~#
whereis kill


kill:
/bin/kill /usr/share/man/man2/kill.2.gz /usr/share/man/man1/kill.1.gz


注意:当需要知道二进制文件保存位置时有用.

27. 命令: service

‘service‘命令控制服务的启动、停止和重启,它让你能够不重启整个系统就可以让配置生效以开启、停止或者重启某个服务。

在Ubuntu上启动apache2server:

1

2

3

4

root@tecmint:~#
service apache2start


 *
Starting webserver

apache2

apache2: Could not reliably determine the server's fully qualified
domain
name, using127.0.1.1for ServerName


httpd (pid
1285) already
running
[ OK ]


重启apache2server:

1

2

3

4

root@tecmint:~#
service apache2restart


*
Restarting webserver

apache2

apache2: Could not reliably determine the server's fully qualified
domain
name, using127.0.1.1for ServerName


 ...
waiting .apache2: Could not reliably determine the server's fully qualified
domain name, using127.0.1.1for ServerName [ OK ]


停止apache2server:

1

2

3

4

root@tecmint:~#
service apache2stop


 *
Stopping webserver
apache2

apache2: Could not reliably determine the server's fully qualified
domain
name, using127.0.1.1for ServerName


...
waiting
[ OK ]


注意:要想使用service命令,进程的脚本必须放在‘/etc/init.d‘,并且路径必须在指定的位置。

如果要运行“service apache2start”实际上实在执行“service /etc/init.d/apache2start”.

28. 命令: alias

alias是一个系统自建的shell命令,允许你为名字比较长的或者经常使用的命令指定别名。

我经常用‘ls -l‘命令,它有五个字符(包括空格)。于是我为它创建了一个别名‘l’。

1

root@tecmint:~#
alias l='ls -l'


试试它是否能用:

1

2

3

4

5

6

7

8

9

10

11

12

root@tecmint:~#
l


total 36


drwxr-xr-x
3 tecmint tecmint4096 May1011:14 Binary


drwxr-xr-x
3 tecmint tecmint4096 May 2111:21Desktop


drwxr-xr-x
2tecmint tecmint4096 May 2115:23 Documents


drwxr-xr-x
8 tecmint tecmint4096 May 2014:56 Downloads


drwxr-xr-x
2tecmint tecmint4096 May  716:58 Music


drwxr-xr-x
2tecmint tecmint4096 May 2016:17 Pictures


drwxr-xr-x
2tecmint tecmint4096 May  716:58 Public


drwxr-xr-x
2tecmint tecmint4096 May  716:58 Templates


drwxr-xr-x
2tecmint tecmint4096 May  716:58 Videos


去掉’l’别名,要使用unalias命令:

1

root@tecmint:~#
unalias l


再试试:

1

2

3

root@tecmint:~#
l


bash: l:
command not found


开个玩笑,把一个重要命令的别名指定为另一个重要命令:

1

2

3

4

5

alias
cd='ls -l' (set alias of ls -l to cd)


alias
su='pwd' (set alias of pwd to su)


....


(You can
create your own)


....


想想多么有趣,现在如果你的朋友敲入‘cd’命令,当他看到的是目录文件列表而不是改变目录;当他试图用’su‘命令时,

他会进入当前目录。你可以随后去掉别名,向他解释以上情况。

29.命令: df

报告系统的磁盘使用情况。在跟踪磁盘使用情况方面对于普通用户和系统管理员都很有用。 ‘df‘ 通过检查目录大小工作,

但这一数值仅当文件关闭时才得到更新。

1

2

3

4

5

6

7

8

9

10

11

12

13

root@tecmint:~#
df


Filesystem
1K-blocksUsed Available Use% Mounted on


/dev/sda1
47929224 7811908 37675948 18% /


none
4
04 0%
/sys/fs/cgroup


udev
1005916 4 1005912
1% /dev


tmpfs
202824816202008 1%
/run


none
5120   0
5120   0% /run/lock


none
1014120 628 1013492 1%
/run/shm


none
102400 44 102356
1% /run/user


/dev/sda5
184307 7985294727 46% /boot


/dev/sda7
95989516 61104 91045676 1% /data


/dev/sda8
91953192 5703287218528 1% /personal


‘df’命令的更多例子请参阅 12df Command Examples in Linux.

30. 命令: du

估计文件的空间占用。 逐层统计文件(例如以递归方式)并输出摘要。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

root@tecmint:~#
du


8
./Daily Pics/wp-polls/images/default_gradient


8
./Daily Pics/wp-polls/images/default


32
./Daily Pics/wp-polls/images


8
./Daily Pics/wp-polls/tinymce/plugins/polls/langs


8
./Daily Pics/wp-polls/tinymce/plugins/polls/img


28
./Daily Pics/wp-polls/tinymce/plugins/polls


32
./Daily Pics/wp-polls/tinymce/plugins


36
./Daily Pics/wp-polls/tinymce


580
./Daily Pics/wp-polls


1456
./Daily Pics


36
./Plugins/wordpress-author-box


16180
./Plugins


12
./May Articles 2013/Xtreme Download Manager


4632
./May Articles 2013/XCache


注意: ‘df‘ 只显示文件系统的使用统计,但‘du‘统计目录内容。‘du‘命令的更详细信息请参阅10 du (Disk Usage) Commands.

31. 命令: rm

‘rm’ 标准移除命令。 rm 可以用来删除文件和目录。

删除目录

1

2

3

root@tecmint:~#
rm PassportApplicationForm_Main_English_V1.0


rm: cannot
remove `PassportApplicationForm_Main_English_V1.0': Is adirectory


‘rm’不能直接删除目录,需要加上相应的’-rf’参数才可以。

1

root@tecmint:~#
rm -rf PassportApplicationForm_Main_English_V1.0


警告: ”rm -rf” 命令是一个破坏性的命令,假如你不小心删除一个错误的目录。一旦你使用’rm -rf’ 删除一个目录,

在目录中所有的文件包括目录本身会被永久的删除,所以使用这个命令要非常小心。

32. 命令: echo

echo 的功能正如其名,就是基于标准输出打印一段文本。它和shell无关,shell也不读取通过echo命令打印出的内容。

然而在一种交互式脚本中,echo通过终端将信息传递给用户。它是在脚本语言,交互式脚本语言中经常用到的命令。

1

2

3

root@tecmint:~#
echo "Tecmint.com is avery good website"


Tecmint.com
is avery good website


创建一小段交互式脚本

1. 在桌面上新建一个文件,命名为 ‘interactive_shell.sh‘ (记住必须带 ‘.sh‘扩展名)。

2. 复制粘贴如下脚本代码,确保和下面的一致。

1

2

3

4

#!/bin/bash


echo
"Please enter your name:"


read
name


echo
"Welcome to Linux $name"


接下来,设置执行权限并运行脚本。

1

root@tecmint:~#
chmod 777 interactive_shell.sh


1

2

3

4

5

root@tecmint:~#
./interactive_shell.sh


Please
enter your name:


Ravi Saive


Welcome to
Linux Ravi Saive


注意: ‘#!/bin/bash‘ 告诉shell这是一个脚本,并且在脚本首行写上这句话是个好习惯。. ‘read‘ 读取给定的输出.

33. 命令: passwd

这是一个很重要的命令,在终端中用来改变自己密码很有用。显然的,因为安全的原因,你需要知道当前的密码。

1

2

3

4

5

6

7

8

9

root@tecmint:~#
passwd


Changing
password for tecmint.


(current)
UNIX password: ********


Enter new
UNIX password: ********


Retype new
UNIX password: ********


Password
unchanged   [
这里表示密码未改变,例如:新密码=旧密码]


Enter new
UNIX password: #####


Retype new
UNIX password:#####


34. 命令: lpr

这个命令用来在命令行上将指定的文件在指定的打印机上打印。

1

root@tecmint:~#
lpr -P deskjet-4620-series1-final.pdf


注意: ”lpq”命令让你查看打印机的状态(是开启状态还是关闭状态)和等待打印中的工作(文件)的状态。

35. 命令: cmp

比较两个任意类型的文件并将结果输出至标准输出。如果两个文件相同, ‘cmp‘默认返回0;如果不同,

将显示不同的字节数和第一处不同的位置。

以下面两个文件为例:

file1.txt

1

2

3

root@tecmint:~#
cat file1.txt


Hi My name
is Tecmint


file2.txt

1

2

3

root@tecmint:~#
cat file2.txt


Hi My name
is tecmint [dot] com


比较一下这两个文件,看看命令的输出。

1

2

3

root@tecmint:~#
cmp file1.txt file2.txt


file1.txt
file2.txt differ: byte15, line1


36. 命令: wget

Wget是用于非交互式(例如后台)下载文件的免费工具.支持HTTP, HTTPS, FTP协议和 HTTP 代理。

使用wget下载ffmpeg

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

root@tecmint:~#
wget ' target='_blank'>http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2[/code] 
--2013-05-22
18:54:52-- ' target='_blank'>http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2[/code] 
Resolving
downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59


Connecting
to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:80...
connected.


HTTP
request sent, awaiting response... 302Found


Location: http://kaz.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 [following]


--2013-05-22
18:54:54-- ' target='_blank'>http://kaz.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2[/code] 
Resolving
kaz.dl.sourceforge.net (kaz.dl.sourceforge.net)... 92.46.53.163


Connecting
to kaz.dl.sourceforge.net (kaz.dl.sourceforge.net)|92.46.53.163|:80...
connected.


HTTP
request sent, awaiting response... 200 OK


Length:
275557 (269K) [application/octet-stream]


Saving to:
‘ffmpeg-php-0.6.0.tbz2’


100%[===========================================================================>]
2,75,55767.8KB/s in4.0s


2013-05-22
18:55:00 (67.8 KB/s) - ‘ffmpeg-php-0.6.0.tbz2’ saved [275557/275557]


37 命令: mount

mount 是一个很重要的命令,用来挂载不能自动挂载的文件系统。你需要root权限挂载设备。

在插入你的文件系统后,首先运行”lsblk”命令,识别出你的设备,然后把分配的设备名记下来。

1

2

3

4

5

6

7

8

9

10

root@tecmint:~#
lsblk


NAME
MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT


sda
8:00 931.5G  0 disk


├─sda1
8:10 923.6G  0 part /


├─sda2
8:201K 0 part


└─sda5
8:50   7.9G  0 part [SWAP]


sr0
11:0 11024M 0 rom


sdb
8:16 1 3.7G 0 disk


└─sdb1
8:17 1 3.7G 0 part


从这个输出上来看,很明显我插入的是4GB的U盘,因而“sdb1”就是要挂载上来的文件系统。以root用户操作,

然后切换到/dev目录,它是所有文件系统挂载的地方。

1

2

3

4

root@tecmint:~#
su


Password:


root@tecmint:~#
cd /dev


创建一个任何名字的目录,但是最好和引用相关。

1

2



root@tecmint:~#
mkdir usb


现在将“sdb1”文件系统挂载到“usb”目录.

1

root@tecmint:~#
mount /dev/sdb1/dev/usb


现在你就可以从终端进入到/dev/usb或者通过X窗口系统从挂载目录访问文件。

是时候让程序猿见识见识Linux环境是多么丰富了!

38. 命令: gcc

gcc是Linux环境下C语言的内建编译器。下面是一个简单的C程序,在桌面上保存为Hello.c(记住必须要有‘.c‘扩展名)。

1

2

3

4

5

6

#include
<stdio.h>


int main()


{


printf("Hello
world\n");


return
0;


}


编译

1

root@tecmint:~#
gccHello.c


运行

1

2

3

root@tecmint:~#
./a.out


Hello
world


注意: 编译C程序时,输出会自动保存到一个名为“a.out”的新文件,因此每次编译C程序 “a.out”都会被修改。

因此编译期间最好定义输出文件名.,这样就不会有覆盖输出文件的风险了。

用这种方法编译

1

root@tecmint:~#
gcc-o Hello Hello.c


这里‘-o‘将输出写到‘Hello‘文件而不是 ‘a.out‘。再运行一次。

1

2

3

root@tecmint:~#
./Hello


Hello
world


39. 命令: g++

g++是C++的内建编译器。下面是一个简单的C++程序,在桌面上保存为Add.cpp (记住必须要有‘.cpp‘扩展名)。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

#include
<iostream>


using
namespace std;


int main()


{


  int
a;


  int
b;


  cout<<"Enter
first number:\n";


  cin
>> a;


  cout
<<"Enter the second number:\n";


  cin>>
b;


  cin.ignore();


  int
result = a+ b;


  cout<<"Result
is"<<" "<<result<<endl;


  cin.get();


return
0;


 }


编译

1

root@tecmint:~#
g++ Add.cpp


运行

1

2

3

4

5

root@tecmint:~#
./a.out


Enter
first number:


...


...


注意:编译C++程序时,输出会自动保存到一个名为“a.out”的新文件,因此每次编译C++程序 “a.out”都会被修改。

因此编译期间最好定义输出文件名.,这样就不会有覆盖输出文件的风险了。

用这种方法编译

1

2



root@tecmint:~#
g++ -o Add Add.cpp


运行

1

2

3

4

5

root@tecmint:~#
./Add


Enter
first number:


...


...


40. 命令: java

Java是世界上使用最广泛的编程语言之一. 它也被认为是高效, 安全和可靠的编程语言. 现在大多数基于网络的服务都使用Java实现.

拷贝以下代码到一个文件就可以创建一个简单的Java程序. 不妨把文件命名为tecmint.java(记住: ’.java’扩展名是必需的).

1

2

3

4

5

class
tecmint {


public
staticvoid main(String[] arguments) {


System.out.println("Tecmint
");


}


}


用javac编译tecmint.java

1

2



root@tecmint:~#
javactecmint.java


运行

1

root@tecmint:~#
javatecmint


注意: 几乎所有的Linux发行版都带有gcc编译器, 大多数发行版都内建了g++ 和 java编译器, 有些也可能没有.

你可以用apt 或 yum 安装需要的包.

请留下您宝贵的意见和想看到的文章类型. 稍后, 我会来一个很有趣主题, 关于Linux的一些鲜为人知的知识.

对 Linux 专家非常有用的 20 个命令

接下来呢?在这篇文章中我将解释管理Linux
服务器所需的一些命令。

41. 命令: ifconfig

ifconfig用来配置常驻内核的网络接口信息。在系统启动必要时用来设置网络适配器的信息。之后,它通常是只需要在调试时或当系统需要调整时使用。

检查活动网络适配器
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

[avishek@tecmint
~]$ ifconfig


eth0
Link encap:Ethernet HWaddr40:2C:F4:EA:CF:0E


  inet
addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0


  inet6
addr: fe80::422c:f4ff:feea:cf0e/64
Scope:Link


  UP
BROADCAST RUNNING MULTICAST MTU:1500 Metric:1


  RX
packets:163843 errors:0 dropped:0 overruns:0 frame:0


  TX
packets:124990 errors:0 dropped:0 overruns:0 carrier:0


  collisions:0
txqueuelen:1000


  RX
bytes:154389832(147.2MiB) TX bytes:65085817 (62.0 MiB)


  Interrupt:20
Memory:f7100000-f7120000


lo
Link encap:Local Loopback


  inet
addr:127.0.0.1 Mask:255.0.0.0


  inet6
addr: ::1/128
Scope:Host


  UP
LOOPBACK RUNNING MTU:16436 Metric:1


  RX
packets:78 errors:0 dropped:0 overruns:0 frame:0


  TX
packets:78 errors:0 dropped:0 overruns:0 carrier:0


  collisions:0
txqueuelen:0


  RX
bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)


检查所有的网络适配器
“-a”参数用来显示所有网络适配器(网卡)的详细信息,包括那些停用的适配器。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

[avishek@tecmint
~]$ ifconfig
-a


eth0
Link encap:Ethernet HWaddr40:2C:F4:EA:CF:0E


  inet
addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0


  inet6
addr: fe80::422c:f4ff:feea:cf0e/64
Scope:Link


  UP
BROADCAST RUNNING MULTICAST MTU:1500 Metric:1


  RX
packets:163843 errors:0 dropped:0 overruns:0 frame:0


  TX
packets:124990 errors:0 dropped:0 overruns:0 carrier:0


  collisions:0
txqueuelen:1000


  RX
bytes:154389832(147.2MiB) TX bytes:65085817 (62.0 MiB)


  Interrupt:20
Memory:f7100000-f7120000


lo
Link encap:Local Loopback


  inet
addr:127.0.0.1 Mask:255.0.0.0


  inet6
addr: ::1/128
Scope:Host


  UP
LOOPBACK RUNNING MTU:16436 Metric:1


  RX
packets:78 errors:0 dropped:0 overruns:0 frame:0


  TX
packets:78 errors:0 dropped:0 overruns:0 carrier:0


  collisions:0
txqueuelen:0


  RX
bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)


virbr0
Link encap:Ethernet  HWaddr 0e:30:a3:3a:bf:03


  inet
addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0


  UP
BROADCAST MULTICAST MTU:1500 Metric:1


  RX
packets:0 errors:0 dropped:0 overruns:0 frame:0


  TX
packets:0 errors:0 dropped:0 overruns:0 carrier:0


  collisions:0
txqueuelen:0


  RX
bytes:0 (0.0 B) TX bytes:0 (0.0 B)


停用网络适配器
1

[avishek@tecmint
~]$ ifconfig
eth0 down


启用网络适配器
1

[avishek@tecmint
~]$ ifconfig
eth0 up


指定IP地址到网络适配器
为网络适配器eth0设定IP地址“192.168.1.12”.

1

[avishek@tecmint
~]$ ifconfig
eth0192.168.1.12


更改网络适配器eth0的子网掩码
1

[avishek@tecmint
~]$ ifconfig
eth0 netmask 255.255.255.


更改网络适配器eth0的广播地址
1

[avishek@tecmint
~]$ ifconfig
eth0 broadcast192.168.1.255


为网络适配器eth0指定IP地址,子网掩码,广播地址
1

[avishek@tecmint
~]$ ifconfig
eth0192.168.1.12netmask 255.255.255.0 broadcast
192.168.1.255


Note:如果你设置一块无线网卡的信息,你可以使用的命令是“iwconfig”.欲知更多ifconfig命令的例子和使用方法,

读“15个有用的ifconfig
命令”.

42. 命令: netstat

netstat命令显示各种网络相关的信息,如网络连接,路由表,接口统计,伪装连接,组播成员身份等….

列出所有的网络端口
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

[avishek@tecmint
~]$ netstat
-a


Active
UNIX domain sockets (servers and established)


Proto
RefCnt Flags
Type
State I-Node Path


unix
2 [ ACC ]
STREAM LISTENING
741379 /run/user/user1/keyring-I5cn1c/gpg


unix
2 [ ACC ]
STREAM LISTENING
8965 /var/run/acpid.socket


unix
2 [ ACC ]
STREAM LISTENING
18584/tmp/.X11-unix/X0


unix
2 [ ACC ]
STREAM LISTENING
741385 /run/user/user1/keyring-I5cn1c/ssh


unix
2 [ ACC ]
STREAM LISTENING
741387 /run/user/user1/keyring-I5cn1c/pkcs11


unix
2 [ ACC ]
STREAM LISTENING
20242@/tmp/dbus-ghtTjuPN46


unix
2 [ ACC ]
STREAM LISTENING
13332/var/run/samba/winbindd_privileged/pipe


unix
2 [ ACC ]
STREAM LISTENING
13331/tmp/.winbindd/pipe


unix
2 [ ACC ]
STREAM LISTENING
11030/var/run/mysqld/mysqld.sock


unix
2 [ ACC ]
STREAM LISTENING
19308/tmp/ssh-qnZadSgJAbqd/agent.3221


unix
2 [ ACC ]
STREAM LISTENING
436781 /tmp/HotShots


unix
2 [ ACC ]
STREAM LISTENING
46110/run/user/ravisaive/pulse/native


unix
2 [ ACC ]
STREAM LISTENING
19310/tmp/gpg-zfE9YT/S.gpg-agent


....


显示所有tcp相关端口
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

[avishek@tecmint
~]$ netstat
-at


Active
Internet connections (servers and established)


Proto
Recv-Q Send-Q Local
Address Foreign
Address
State


tcp
0 0
localhost:mysql
*:*
LISTEN


tcp
0 0
*:5901
*:*
LISTEN


tcp
0 0
*:5902
*:*
LISTEN


tcp
0 0
*:x11-1
*:*
LISTEN


tcp
0 0
*:x11-2
*:*
LISTEN


tcp
0 0 *:5938
*:*
LISTEN


tcp
0 0
localhost:5940
*:*
LISTEN


tcp
0 0 ravisaive-OptiPl:domain
*:*
LISTEN


tcp
0 0 ravisaive-OptiPl:domain *:*
LISTEN


tcp
0 0
localhost:ipp
*:*
LISTEN


tcp
0 0 ravisaive-OptiPle:48270
ec2-23-21-236-70.c:http ESTABLISHED


tcp
0 0 ravisaive-OptiPle:48272
ec2-23-21-236-70.c:http TIME_WAIT


tcp
0 0 ravisaive-OptiPle:48421
bom03s01-in-f22.1:https ESTABLISHED


tcp
0 0 ravisaive-OptiPle:48269
ec2-23-21-236-70.c:http ESTABLISHED


tcp
0 0 ravisaive-OptiPle:39084
channel-ecmp-06-f:https ESTABLISHED


...


显示所有连接的统计信息
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

[avishek@tecmint
~]$ netstat
-s


Ip:


   4994239
total packets received


0
forwarded


0
incoming packets discarded


   4165741
incoming packets delivered


3248924
requests sent out


   8
outgoing packets dropped


Icmp:


29460
ICMP messages received


566
input ICMP message failed.


ICMP
input histogram:


destination
unreachable: 98


redirects:
29362


2918
ICMP messages sent


0
ICMP messages failed


ICMP
output histogram:


destination
unreachable: 2918


IcmpMsg:


InType3:
98


InType5:
29362


OutType3:
2918


Tcp:


94533
active connections openings


23
passive connection openings


5870
failed connection attempts


7194
connection resets received


....


好的!由于某些原因如果你不想解析netstat 输出的主机、端口和用户名称的话 。

1

[avishek@tecmint
~]$ netstat
-an


好,你可能需要获取的 netstat 持续输出的动态信息,通过传递中断输出指令
(ctrl + c)来停止。

1

[avishek@tecmint
~]$ netstat
-c


更多关于“netstat”的例子和使用方法,浏览文章“20个netstat 的使用案例”。

43. 命令: nslookup

网络实用程序,用于获得互联网服务器的信息。顾名思义,该实用程序将发现通过查询
DNS 域的名称服务器信息。

1

2

3

4

5

6

7

8

[avishek@tecmint
~]$ nslookup
tecmint.com


Server:
192.168.1.1


Address:
192.168.1.1#53


Non-authoritative
answer:


Name:
tecmint.com


Address:
50.16.67.239


查询邮件交换器记录
1

2

3

4

5

6

7

8

9

10

[avishek@tecmint
~]$ nslookup
-query=mx tecmint.com


Server:
192.168.1.1


Address:
192.168.1.1#53


Non-authoritative
answer:


tecmint.com
mail exchanger = 0 smtp.secureserver.net.


tecmint.commail exchanger =10 mailstore1.secureserver.net. 


Authoritative
answers can be found from:


查询域名服务器
1

2

3

4

5

6

7

8

9

10

[avishek@tecmint
~]$ nslookup
-type=ns tecmint.com


Server:
192.168.1.1


Address:
192.168.1.1#53


Non-authoritative
answer:


tecmint.com
nameserver = ns3404.com.


tecmint.com
nameserver = ns3403.com.


Authoritative
answers can be found from:


查询DNS记录
1

2

3

4

5

6

7

8

9

10

11

12

13

14

[avishek@tecmint
~]$ nslookup
-type=any tecmint.com


Server:
192.168.1.1


Address:
192.168.1.1#53


Non-authoritative
answer:


tecmint.commail exchanger =10 mailstore1.secureserver.net. 


tecmint.com
mail exchanger = 0 smtp.secureserver.net.


tecmint.com
nameserver = ns06.domaincontrol.com.


tecmint.com
nameserver = ns3404.com.


tecmint.com
nameserver = ns3403.com.


tecmint.com
nameserver = ns05.domaincontrol.com.


Authoritative
answers can be found from:


查询起始授权机构
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

[avishek@tecmint
~]$ nslookup
-type=soatecmint.com


Server:
192.168.1.1


Address:
192.168.1.1#53


Non-authoritative
answer:


tecmint.com


origin
= ns3403.hostgator.com


mail
addr = dnsadmin.gator1702.hostgator.com


serial
= 2012081102


refresh
=86400


retry
= 7200


expire
= 3600000


minimum
=86400


Authoritative
answers can be found from:


查询端口号
更改使用你想要连接的端口号

1

2

3

4

5

6

7

[avishek@tecmint
~]$ nslookup
-port 56 tecmint.com


Server:
tecmint.com


Address:
50.16.76.239#53


Name:
56


Address:
14.13.253.12


44.命令:dig

dig是查询DNS 域名服务器的工具,可以查询的主机地址、 邮件交流、 域名服务器相关的信息。在任何
Linux (Unix)


Macintosh OS X 操作系统上,都可以使用该工具。dig的最典型的用法是单个主机的查询。

1

2

3

4

5

6

[avishek@tecmint
~]$ dig
tecmint.com


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com


;; global
options: +cmd


;; Got
answer:


;;
->>HEADER<


关闭注释行
1

2

3

4

5

6

7

8

9

10

[avishek@tecmint
~]$ dig
tecmint.com+nocomments 


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com+nocomments


;; global
options: +cmd


;tecmint.com.
IN  A


tecmint.com.
14400 IN A 40.216.66.239


;; Query
time:418 msec


;; SERVER:
192.168.1.1#53(192.168.1.1)


;; WHEN:
Sat Jun 2913:53:222013


;; MSG
SIZE rcvd:45


关闭认证块
1

2

3

4

5

6

[avishek@tecmint
~]$ dig
tecmint.com+noauthority 


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com+noauthority


;; global
options: +cmd


;; Got
answer:


;;
->>HEADER<


关闭 其他 块
1

2

3

4

5

6

[avishek@tecmint
~]$ dig
tecmint.com+noadditional 


;
<<>> DiG 9.9.2-P1<<>> tecmint.com+noadditional


;; global
options: +cmd


;; Got
answer:


;;
->>HEADER<


关闭 统计块
1

2

3

4

5

6

[avishek@tecmint
~]$ dig
tecmint.com+nostats 


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com+nostats


;; global
options: +cmd


;; Got
answer:


;;
->>HEADER<


关闭回复块
1

2

3

4

5

6

[avishek@tecmint
~]$ dig
tecmint.com+noanswer 


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com+noanswer


;; global
options: +cmd


;; Got
answer:


;;
->>HEADER<


关闭所有块
1

2

3

4

[avishek@tecmint
~]$ dig
tecmint.com+noall 


;
<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>>
tecmint.com+noall


;; global
options: +cmd


阅读更多10 LinuxDig 命令实例

45.命令: uptime

你连接到你的Linux
服务器时发现一些不寻常或恶意的东西,你会做什么?猜测……不,绝不!

你可以运行uptime来验证当服务器无人值守式到底发生了什么事情。

1

2

3

[avishek@tecmint
~]$ uptime


14:37:10
up 4:21, 2users, load average: 0.00, 0.00, 0.04


46. 命令: wall

对系统管理员来说一个最重要的命令.wall发送一条消息到大家登录端将其mesg权限设置为”yes”。这条信息可以被wall作为参数,

或者可以将它作为wall的标准输入。

1

2

3

4

5

[avishek@tecmint
~]$ wall "we will be going down for maintenance for one hour sharply at
03:30 pm"


Broadcast
message from root@localhost.localdomain (pts/0) (Sat Jun 2914:44:022013):


we will be
going down for
maintenance for
one hour sharply at 03:30 pm


47. 命令: mesg

其他人们可以使用”wtrite”命令,将在在向您发送文本到屏幕上。你可以控制是否显示。

1

mesg
[<strong>n</strong>|<strong>y</strong>]
<strong>n</strong> - prevents the message from others popping up
on the screen. <strong>y</strong> – Allows messages to appear on
your screen.


48. 命令: write

如果 ‘mesg’ 是 ‘y’,让你的文本直接发送到另一台
Linux 机器的屏幕。.

1

[avishek@tecmint
~]$ write ravisaive


49. 命令: talk

增强的write命令,talk命令可让你与其他登录的用户交谈。

1

[avishek@tecmint
~]$ talk ravisaive


注释: 如果talk命令没安装的话,可以通过apt或yum
安装所需的包.

1

2

3

[avishek@tecmint
~]$ yum install
talk


OR


[avishek@tecmint
~]$ apt-get install
talk


50. 命令:w

是否觉得命令’w'很滑稽?但是事实上不是的。它是一个命令,尽管只有一个字符长!命令”w“是uptimewho命令,

以前后的顺序组合在一起。

1

2

3

4

5

6

7

[avishek@tecmint
~]$ w


15:05:42
up 4:49, 3 users, load average: 0.02, 0.01, 0.00


USER
TTY
FROM
LOGIN@   IDLE   JCPU   PCPU WHAT


server
tty7 :0
14:06 4:43m 1:42 0.08s pam: gdm-passwo


server
pts/0
:0.0
14:180.00s 0.23s 1.65s gnome-terminal


server
pts/1
:0.0
14:47 4:43 0.01s 0.01s bash


51. 命令: rename

见名知意,这个命令重命名文件。rename将会通过从文件名的首字符开始替换,重命名为指定的文件名。

1

Give the
file
names a1, a2, a3, a4.....1213


仅仅写这些命令:[@Lesus 注: 在Ubuntu上不支持这种格式, rename与mv不同的是,rename可以批量修改,如同带了while的mv操作。]

1

2

rename a1
a0 a


rename a1
a0 a


52. 命令: top

显示CPU进程信息。这个命令自动刷新,默认是持续显示CPU进程信息,除非使用了中断指令。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

[avishek@tecmint
~]$ top


top
-14:06:45
up10 days, 20:57, 2users, load average: 0.10, 0.16, 0.21


Tasks: 240
total, 1running, 235 sleeping, 0
stopped, 4 zombie


%Cpu(s):
2.0 us,  0.5 sy,  0.0 ni, 97.5 id,  0.0 wa,  0.0
hi,  0.0 si,  0.0 st


KiB
Mem: 2028240 total, 1777848 used, 250392
free, 81804 buffers


KiB
Swap: 3905532total, 156748 used, 3748784
free, 381456 cached


  PID
USER PR NI VIRT RES SHR
S %CPU %MEMTIME+
COMMAND


23768
ravisaiv 20 01428m 571m 41m S 2.3
28.9 14:27.52
firefox


24182
ravisaiv 20 0 511m132m 25m S
1.7 6.7 2:45.94
plugin-containe


26929 ravisaiv
20 0 53441432 972R 0.7
0.1 0:00.07 top


24875
ravisaiv 20 0 263m 14m 10m S
0.3 0.7 0:02.76
lxterminal


   1
root 20 0 389619281228
S 0.0 0.1 0:01.62
init


2
root 20 0
000 S 0.0
0.0 0:00.06
kthreadd


3
root 20 0
000 S 0.0
0.0 0:17.28 ksoftirqd/0


5
root 0 -20
000 S 0.0
0.0 0:00.00
kworker/0:0H


7
root 0 -20
000 S 0.0
0.0 0:00.00
kworker/u:0H


   8
root rt 0
000 S 0.0
0.0 0:00.12migration/0


9
root 20 0
000 S 0.0
0.0 0:00.00
rcu_bh


  10
root 20 0
000 S 0.0
0.0 0:26.94
rcu_sched


  11
root rt 0
000 S 0.0
0.0 0:01.95 watchdog/0


  12
root rt 0
000 S 0.0
0.0 0:02.00 watchdog/1


  13
root 20 0
000 S 0.0
0.0 0:17.80 ksoftirqd/1


  14
root rt 0
000 S 0.0
0.0 0:00.12migration/1


  16
root 0 -20
000 S 0.0
0.0 0:00.00
kworker/1:0H


  17
root 0 -20
000 S 0.0
0.0 0:00.00
cpuset


  18
root 0 -20
000 S 0.0
0.0 0:00.00
khelper


  19
root 20 0
000 S 0.0
0.0 0:00.00
kdevtmpfs


   20
root 0 -20
000 S 0.0
0.0 0:00.00
netns


   21
root 20 0
000 S 0.0
0.0 0:00.04
bdi-default


   22
root 0 -20
000 S 0.0
0.0 0:00.00
kintegrityd


   23
root 0 -20
000 S 0.0
0.0 0:00.00
kblockd


   24
root 0 -20
000 S 0.0
0.0 0:00.00 ata_sff


另查看12
TOP命令例子·[@Lesus 注:htop比top命令更好用,不过需要自己安装

53. 命令: mkfs.ext4

这个命令在指定的设备上创建一个新的ext4文件系统,如果这个命令后面跟的是个错误的设备,那么整个设备就会被擦除和格式化,

所以建议不要运行这个命令,除非你清楚自己正在干什么。

1

2

Mkfs.ext4
/dev/sda1
(sda1block will be formatted)


mkfs.ext4
/dev/sdb1
(sdb1block will be formatted)


54. vi/emac/nano 命令

vi(visual),emac,nano是 linux 中最常用的一些编辑器。它们经常用于编辑文本,配置,…
等文件.

A
quick guide to work around vi and nano is, emacis a.

vi 编辑器:
1

2

[avishek@tecmint
~]$ touch
a.txt (
创建一个名为a.txt的文本文件)


[avishek@tecmint
~]$ vi
a.txt (
用vi打开a.txt)


[按下‘i’键进入插入模式, 否则你不能输入任何内容]

1

echo
"Hello"
(
这里的文本会存到文件中)


alt+x(退出插入模式,
记得在最后的字符间留有一些空格.

ctrl+x命令或你上一个单词将被删除).

:wq!(以当前的文本保存文件, 记住‘!’ 是覆盖的意思).

nano 编辑器:
1

[avishek@tecmint
~]$ nano a.txt (
用nano打开 a.txt)


1

edit, with
the content, required


ctrl +x (关闭编辑器).它会显示如下的提示输出信息:

1

2

3

Save
modified buffer (ANSWERING "No"
WILL DESTROY
CHANGES)


Y
Yes


 N
No ^C Cancel


点击‘y’ 选择 yes 并输入文件名,就完成编辑了.

55. 命令: rsync

Rsync复制文件,参数-P开启进度条。如果你已经安装了rsync,你可以使用一个简单的别名。

1

alias
cp='rsync
-aP'


现在尝试在终端复制一个大文件,这样将会看到显示剩余部分的输出,与进度条类似。

而且,保持和维护备份是系统管理员不得不做的最重要、最无聊的工作之一。Rsync是一个用于新建和维护备份的非常好用的终端工具

(也存在许多其它工具)。

1

2

3

4

5

6

7

[avishek@tecmint
~]$ rsync
-zvr IMG_5267\ copy\=33\ copy\=ok.jpg ~/Desktop/


sending
incremental file
list


IMG_5267
copy=33 copy=ok.jpg


sent
2883830 bytes  received 31bytes  5767722.00 bytes/sec


total size
is 2882771 speedup is1.00


注意:-z表示压缩, -v表示详细信息,-r表示递归。

56. 命令: free

跟踪内存的使用和资源一样重要,就像管理员执行的任何其它任务,可以使用 'free'
命令来在这里救援.

当前内存使用状态Current Usage Status of Memory
1

2

3

4

5

6

[avishek@tecmint
~]$ free


 total
used free

shared
buffers cached


Mem:
2028240 1788272
239968
0 69468 363716


-/+
buffers/cache: 1355088 673152


Swap:
39055321570763748456


设置输出单位为KB,MB或GB
1

2

3

4

5

6

[avishek@tecmint
~]$ free
-b


 total
used free

shared
buffers cached


Mem:
20769177601838272512
238645248 0
71348224 372670464


-/+
buffers/cache:1394253824 682663936


Swap:
3999264768 160845824 3838418944


1

2

3

4

5

6

[avishek@tecmint
~]$ free
-k


 total
used free

shared
buffers cached


Mem:
2028240 1801484
226756
0 69948 363704


-/+
buffers/cache: 1367832660408


Swap:
39055321570763748456


1

2

3

4

5

6

[avishek@tecmint
~]$ free
-m


 total
used free

shared
buffers cached


Mem:
1980
1762
218
0
68355


-/+
buffers/cache: 1338
641


Swap:
3813
153 3660


1

2

3

4

5

6

[avishek@tecmint
~]$ free
-g


 total
used free

shared
buffers cached


Mem:
1
1
0 0
0 0


-/+ buffers/cache:
1 0


Swap:
3
0 3


以可读的格式显示,检查当前内存使用
1

2

3

4

5

6

[avishek@tecmint
~]$ free
-h


 total
used free

shared
buffers cached


Mem:
1.9G
1.7G 208M
0B
68M 355M


-/+
buffers/cache:
1.3G 632M


Swap:
3.7G
153M 3.6G


设定时间间隔后,持续检查使用状态
1

2

3

4

5

6

7

8

9

10

11

[avishek@tecmint
~]$ free
-s 3


 total
used free

shared
buffers cached


Mem:
2028240 1824096
204144
0 70708 364180


-/+
buffers/cache: 1389208 639032


Swap:
39055321570763748456


 total
used free

shared
buffers cached


Mem:
2028240 1824192
204048
0 70716 364212


-/+
buffers/cache: 1389264 638976


Swap:
39055321570763748456


57. mysqldump 命令

好了,现在你从名字上就能明白这个命令所代表的作用。mysqldump命令会转储(备份)数据库的全部或特定一部分数据到一个给定的文件中。

例如:

1

[avishek@tecmint
~]$ mysqldump -u root -p --all-databases >
/home/server/Desktop/backupfile.sql


注意:mysqldump需要 mysql 在运行中并且有正确的授权密码。我们在用mysqldump命令备份数据库中讨论了一些有用的 “mysqldump” 命令用法。

58. mkpasswd 命令

根据指定的长度,产生一个难猜的随机密码。

1

2

3

[avishek@tecmint
~]$ mkpasswd -l10


zI4+Ybqfx9


1

2

3

[avishek@tecmint
~]$ yum install
expect




[avishek@tecmint
~]$ apt-get install
expect


注意:-l
10
产生一个10个字符的随机密码,而-l
20
产生20个字符的密码,它可以设置为任意长度来取得所希望的结果。

这个命令很有用,经常在脚本语言里使用来产生随机的密码。你可能需要yumapt‘expect’
包来使用这个命令。

1

2

3

[avishek@tecmint
~]$ yum install
expect




[avishek@tecmint
~]$ apt-get install
expect


59. paste 命令

合并两个或多个文本文件,按行来进行合并。示例。如果 file1的内容是:

1

2

3

1


2


3


file2是这样的:

1

2

3

4

a


b


c


d


1

[avishek@tecmint
~]$ paste
file1file2> file3


结果file3将是:

1

2

3

4

1
a


2
b


3
c


 d


60.lsof 命令

lsof
是"list
open files("列表中打开的文件")
的缩写,显示您的系统当前已打开的所有文件。这是非常有用的对于想找出哪些进程使用某一特定文件,

或显示为单个进程打开所有文件。一些有用的10 个lsof 命令示例,你可能会感兴趣阅读。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

[avishek@tecmint
~]$ lsof


COMMAND
PID
TID
USER FD TYPE
DEVICE SIZE/OFF

NODE NAME


init
1
root cwd
DIR 8,1
4096 2/


init
1
root rtd
DIR 8,1
4096 2/


init
1
root txt
REG 8,1
227432395571/sbin/init


init
1
root mem
REG 8,1
47080 263023 /lib/i386-linux-gnu/libnss_files-2.17.so


init
1
root mem
REG 8,1
42672270178 /lib/i386-linux-gnu/libnss_nis-2.17.so


init
1
root mem
REG 8,1
87940 270187 /lib/i386-linux-gnu/libnsl-2.17.so


init
1
root mem
REG 8,1
30560 263021/lib/i386-linux-gnu/libnss_compat-2.17.so


init
1
root mem
REG 8,1
124637 270176 /lib/i386-linux-gnu/libpthread-2.17.so


init
1
root mem
REG 8,1
1770984 266166 /lib/i386-linux-gnu/libc-2.17.so


init
1
root mem
REG 8,1
30696 262824 /lib/i386-linux-gnu/librt-2.17.so


init
1
root mem
REG 8,1
34392262867 /lib/i386-linux-gnu/libjson.so.0.1.0


init
1
root mem
REG 8,1
296792262889 /lib/i386-linux-gnu/libdbus-1.so.3.7.2


init
1
root mem
REG 8,1
34168 262840 /lib/i386-linux-gnu/libnih-dbus.so.1.0.0


init
1
root mem
REG 8,195616
262848 /lib/i386-linux-gnu/libnih.so.1.0.0


init
1
root mem
REG 8,1
134376 270186 /lib/i386-linux-gnu/ld-2.17.so


init
1
root0u
CHR
1,3 0t0
1035 /dev/null


init
1
root 1u
CHR
1,3 0t0
1035 /dev/null


init
1
root2u
CHR
1,3 0t0
1035 /dev/null


init
1
root3r
FIFO
0,8 0t0
1714 pipe


init
1
root 4w
FIFO
0,8 0t0
1714 pipe


init
1
root5r
0000
0,9
0 6245 anon_inode


init
1
root6r
0000
0,9
0 6245 anon_inode


init
1
root7u unix
0xf5e91f80
0t0 8192@/com/ubuntu/upstart


init
1
root 8w
REG 8,1
3916394
/var/log/upstart/teamviewerd.log.1(deleted)


这里并没有结束,系统管理员会很多东西,为你提供漂亮的界面,服务于你的工作。系统管理实际上是学习和实现的一门优雅的艺术。

我们会尽力给你介绍
linux 专业人员必须了解的知识以及一些其他必要东西,linux本身是基础的,简单的。深入理解是不断学习的过程。

你的美言好词总是在不断鼓励我们写出更多的优秀,丰富的文章。"喜之以分享,助我来传播"。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: