Linux common commands-1: ls

ls is the abbreviation of the English word list , and its function is to list the contents of the specified directory and its related attribute information. By default, ls lists the contents of the current directory. With parameters, we can do more with ls .

Example

View current directory

 (base) xugaoxiang@1070Ti:~$ ls -l total 60 drwxr-xr-x 17 xugaoxiang xugaoxiang 4096 7月23 16:11 anaconda3 drwxrwxrwx 3 xugaoxiang xugaoxiang 4096 9月16 14:37 Documents drwxrwxrwx 4 xugaoxiang xugaoxiang 16384 1月12 17:34 Downloads drwxrwxrwx 4 xugaoxiang xugaoxiang 4096 1月17 18:10 Pictures drwxrwxrwx 8 xugaoxiang xugaoxiang 4096 1月13 14:26 Playground drwx------ 5 xugaoxiang xugaoxiang 4096 4月28 2020 snap drwxrwxr-x 2 xugaoxiang xugaoxiang 4096 10月25 10:50 SunloginRemote drwxrwxrwx 2 xugaoxiang xugaoxiang 4096 11月15 17:04 Tools drwxrwxrwx 5 xugaoxiang xugaoxiang 4096 12月2 15:20 Videos drwxrwxrwx 11 xugaoxiang xugaoxiang 4096 11月29 15:41 Works drwxrwxrwx 17 xugaoxiang xugaoxiang 4096 12月1 16:08 workshop drwxrwxrwx 3 xugaoxiang xugaoxiang 4096 3月29 2021 www (base) xugaoxiang@1070Ti:~$

View a specific directory

 (base) xugaoxiang@1070Ti:~$ ls -l /opt/ total 28 drwxrwxr-x 5 root root 4096 3月24 2020 baidunetdisk drwx--x--x 4 root root 4096 4月1 2020 containerd drwxr-xr-x 4 root root 4096 4月22 2020 google drwxr-xr-x 6 root root 4096 4月1 2021 intel drwxr-xr-x 3 root root 4096 4月10 2020 kingsoft drwxrwxr-x 5 root root 4096 4月22 2020 Termius drwxr-xr-x 7 root root 4096 5月8 2021 todesk (base) xugaoxiang@1070Ti:~$

This article is reprinted from https://xugaoxiang.com/2022/06/01/linux-cmds-1-ls/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment