More for you to like:
Closed Captioning Closed captioning available on our YouTube channel
You Might Like

How to use the ls command: 2-Minute Linux Tips

Network World | Feb 14, 2020

In this Linux tip, learn how to use the ls command. The ls command is one of the most basic commands. It’s used to list files and it has some very useful options.

Copyright © 2020 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at one of the most basic Linux commands – ls. It’s used to list files and it has some very useful options. When you log into a Linux system and type “ls”, it’s going to list the files and directories (folders) in your home directory on that system. Type “ls” followed by the name of some other directory and it will list the files in that directory.
With just “ls”, you will get a very basic listing.
If you use -a as an option, you’ll also see files and directories with names that begin with dots. These are generally used to configure your account, so most of the time, you probably won’t even want to see those details.
If you use -l, you’ll see what’s referred to as a long listing (thus the “l”).
The chunks of information in each line refer to … the kind of file (- is a regular file, d means a directory) and file permissions, links – the number of files that refer to the file, the owner and group associated with the file (dory is owner and dory is her group), the size of the file (in bytes), when the file was created or last updated, the file name.
The permissions granted involve r (read), w (write) and x (execute or run the file). If we look at the myscript file, dory can red, write and execute the file. If anyone else is in the dory group, those individuals can read and execute the file. Everyone else (the 3rd group) can’t do anything with the file – not even look at it.
There are other things that you can do with ls. You can list files in other directories by typing “ls” followed by the name of the directory.
You can list files that match some pattern. For example, to list files that start with an “m”, use the command “ls m*”.
That’s your Linux tip for the ls command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
Popular
Featured videos from IDG.tv