我是靠谱客的博主 精明大树,这篇文章主要介绍linux常用的20个命令是什么,现在分享给大家,希望可以做个参考。

本教程操作环境:Red Hat Enterprise Linux 6.1系统、Dell G3电脑。

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
root@tecmint:~# ls -l total 40588drwxrwxr-x 2 ravisaive ravisaive 4096 May 8 01:06 Android Games drwxr-xr-x 2 ravisaive ravisaive 4096 May 15 10:50 Desktop drwxr-xr-x 2 ravisaive ravisaive 4096 May 16 16:45 Documents drwxr-xr-x 6 ravisaive ravisaive 4096 May 16 14:34 Downloads drwxr-xr-x 2 ravisaive ravisaive 4096 Apr 30 20:50 Music drwxr-xr-x 2 ravisaive ravisaive 4096 May 9 17:54 Pictures drwxrwxr-x 5 ravisaive ravisaive 4096 May 3 18:44 Tecmint.com drwxr-xr-x 2 ravisaive ravisaive 4096 Apr 30 20:50 Templates
登录后复制

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

复制代码
1
2
3
4
5
6
7
8
9
10
11
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字节.

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

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

  • 最后

    以上就是精明大树最近收集整理的关于linux常用的20个命令是什么的全部内容,更多相关linux常用内容请搜索靠谱客的其他文章。

    本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(98)

评论列表共有 0 条评论

立即
投稿
返回
顶部