Note: Use one of the above commands to print the version of the ls command.To change your BIOS settings on an x86, AMD64, or Intel® 64 system, watch the instructions provided on your display when your computer first boots. How to list the version of the ls command? If you want this list to be printed in the human readable then you can use 'ls -lSh'. In the above example you can see the largest size file (lastlog) shown at the beginning of the list. Note: Using the above command will list all the files and directories sorted by file size. How to list files and directories sorted by file-size? In the above example you can see all the files listed under the Desktop directory. Note: Using the above command, you can get a list of all the files under a particular directory. In the above example you can see the details of "testing" directory details. Note: Using the above command you can get a list of a particular directory using the 'ls -ld directory name' command. How to list a particular directory details? In the above example you can see the details of "cron.txt" file details. Note: Using the above command, you can get the list of a particular file using the 'ls -l filename' command. In order to determine the size of any directory, you can use the du command 13. In addition, the ls command won't display the total amount of space taken up by the contents of the directory. Reading files in bytes may get confusing instead we can read files in KB,MB,GB etc, it is much easier "e.g.," To read 5782242 bytes will get confused whereas to read 5.7 M is much more user-friendly. Note: Using the 'ls -lh' option will show the size of each file in a human-readable format. How to list the size of the files in a human-readable format? These two files are the newly created ones. In the above example you can see a folder named 'linuxteck' and a file named 'test' are listed in the first place. Note: Option 'ls -t' will list out all the recently modified files and folders first. How to list the most recently modified files and folders? Note: Using the 'ls -lR' option will long list in the tree format of all directory and sub-directories. How to get a recursive listing of all sub-directories? In the above example you can see, all the files and directories are sorted in reverse alphabetical order. Note: The 'ls -r' option will list all files and directories in reverse order. How to list all the files and directories in reverse order? In the above example you can see a normal user and group (UID and GID) has 1000 whereas the root UID and GID has 0. Note: Using the 'ls -n' option will list the UID (User ID) and GID (Group ID) of all the files and directory as one per line. How to list UID and GID of files and directories? Note: Using 'ls -m' will display all the files and directories separated by a comma. How to list the files and directories separated by a comma? In the above example you can have some number index/inode printed before the files and directories. Note: The 'ls -i' option will list the index (called inode) number of each file and directory. How to list the index (inode) number of each File and Directory? In the above example it lists all the files without owner details. Note: The 'ls -g' option is similar to the 'ls -l' option, but with the '-g' option it will skip the owner details of the files and directories. How to list all the files and directories without the owner details? In the above example, you can see all the directories are listed with '/' sign at the end. Note: Using 'ls -F' will add '/' classification at the end of each directory. How to list Directories with '/' classification at the end? In Unix/Linux all hidden files begin with the dot '.' the formats are marked hidden. Note: 'ls -a' will list all the hidden files started with (DOT '.') format along with the normal files. The line started with some characteristics of "file or directory permission, Owner and Group Name, File size, created/modified date and time, file/folder name". Note: Using the 'ls -l' option will display a long listing format of content one per line of the current directory. How to long list one per line for all files and directories? Note: Using the 'ls' command with no option will simply list all files and directories. Sssd Xorg.9.log audit cron-20190730 httpd mariadb ppp How to list files using 'ls' with no option?Īnaconda cron-20190721 glusterfs maillog-20190804 pluto secure-20190730
0 Comments
Leave a Reply. |