Terminal window, list files and file permissions: pwd, ls

6 minutes
Share the link to this page
Copied
  Completed
Commands practiced in this lecture: pwd, ls

Transcript

This is my Linux environment. It's a Linux Mint distribution with a desktop environment called cinnamon. Mint is a very user friendly distribution. If you're looking for something that is easy to use from the start, it could be a very good option. Although these days there are also other distributions that are easy to use, such as Ubuntu or Fedora. There are more advanced distributions such as Arch Linux, or slackware, which might require a deeper understanding of the underlying system functions.

However, there is one common thing in all distributions that you can have access to the terminal and make configurations to your operating system low level. This is something we will practice in this course. So let's get started. First thing we need is a terminal where we can type commands. In my Linux Mint, it was already conveniently position in the taskbar. For you, it could also be in the system menu, like here, or maybe you can type in Terminal in the search field.

Once we open the terminal we see a command prompt, which means that the terminal is ready to accept user commands. Let's go ahead and type our first command to print working directory or pwd. It shows our current directory and where you're located in the file system at this moment. After opening the terminal length in the home directory. Here you can create your documents system configuration files and such. These files will only be visible to you and nobody else works in your computer.

Except with MIDI system administrators could have access to these files. If you're not used to the file system in Linux in notation, so directory paths Don't worry. We will be covering this throughout the course. Let's see what is in our home directory by typing the list command. On the freshly installed system there will be several default directories such as documents, pictures, and others. Now let us make the output a little more useful by adding two arguments to the list command l n A Let's now printed the full list of files including those not usually visible starting with dots.

These are mostly configuration files. We also got reach information for each file and directory. Now let's talk for a moment and see what this command did. String LS denotes the instruction to the terminal to list files. The arguments la types with a dash in front describe how exactly you want to see your files. You can combine several arguments such as I did by combining L and ne together with a single dash.

Alternatively you can always write LS minus L minus a and this will be the same. Some arguments also have the long form for better readability which in the case of the minus A argument would be minus minus all. You can also list all commands by typing ls minus minus help us curl up in the terminal to the Beginning you will see there are many options how to see file information, such as sorting by date, or size all these files in human readable format. At this time, feel free to pause the video and try various output formats for the ls command. Go ahead now let's now have a closer look at the output of the LS minus la command. There are several columns printed for each file.

The first column is file type and file permissions. The first character of the string denotes file type. for regular file this attribute is shown as a dash. For symbolic links which is a special file the attribute is set to L and for directories it is the the restaurant characters show file permissions. They're grouped by three characters for read our write, W and execute acts for three types of users. The first group specifies access For the owner of the file, in this example the user which is you can have full access to directory pictures.

But you cannot execute the file dot profile. As this is not an executable file, there is no x permission. The second group has permissions given for the group of the user. Choosing Linux belongs to one or more groups and file permissions can be shared among users. So the same group, the group of users for the file is listed in the fourth column. And in this case had the same as my user.

Should there be other users that belong to this group, they would also have access to a directory pictures for example. The third group denotes permissions to everyone else. pictures in these cases also set as public but we can of course change it. second column in the output is the count of hard links to the file. This number is not Not something that I personally needed in my day to day work, and it will keep it for now. The next two columns they know the file owner and his group, something that we just covered with the file permissions.

Next column is file size. This is just the size of the file in bytes regular files, and for directories it specifies the amount of space it takes to hold information by the directory. in Linux directories are special type of files. Do not be confused with the total space taken by all files in the directory which it is not. But also this information is easy to get. The next column is pretty straightforward, which is modification date that says when the file was last modified.

Lastly, we have the file name. To sum up in this section, we have covered a few fundamentals. You learn how to open the terminal what command arguments are and how to read file permissions. In the next lecture, we will learn how to change file permissions navigating the terminal window navigate the file system.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.