![linux file details linux file details](https://www.cyberciti.biz/media/new/images/faq/2013/04/get-year.png)
You can accomplish the same thing by using the tilde ( ~) like this: cd ~ Finding Your Current Directory with pwd Environment variables are discussed in greater detail in Chapter 10, “Command-Line Master Class.” Type this command and press Enter to return to your home directory: cd $HOME
![linux file details linux file details](https://assets.qwikresume.com/resume-samples/pdf/screenshots/senior-linux-administrator-1590206299-pdf.jpg)
You can also use the $HOME shell environment variable to accomplish the same thing. To return to your home directory from anywhere in the Linux file system, use the cd command like this: cd For example, to quickly move up to the parent directory, the one above the one you are currently in, use the cd command like this: cd. You can also use the cd command with several shortcuts. You can also specify an exact location for a directory, like this: cd /home/matthew/stuff/somedir That looks in the current directory for the somedir subdirectory, and then moves you into it. It might help you remember this command to think of it meaning “change directory.” The most basic usage of cd is this: cd somedir Use the cd command to move within the file system from one directory to another. For more information about redirects and combining commands, see Chapter 12, “Automating Tasks and Shell Scripting.” In the meantime, note that you can read the contents of that text file using the command less listing.txt, which lets you read the file bit by bit using the arrow keys to navigate in the file (or Enter to move to the next line), the spacebar to move to the next page, and q to exit when done. At the command line, you can use files as inputs to commands, or you can generate files as outputs as shown. The previous command sends the output of ls -laR to a file called listing.txt and demonstrates part of the power of the Linux command line. (Both files and subdirectories are included remember that the listing here is abbreviated.) Then, the details are as shown in Figure 9.1.
![linux file details linux file details](https://i.pinimg.com/736x/dd/94/44/dd9444773962564284e729bde15d9db5.jpg)
The listing starts with the number of items in the directory. The listing (abbreviated here) is now given with one item per line, but with multiple columns. rw-r-r- 1 matthew matthew 675 16:48.profile localĭrwxr-xr-x 2 matthew matthew 4096 17:07 Musicĭrwxr-xr-x 3 matthew matthew 4096 6 18:07 Pictures bashrcĭrwxr-xr-x 13 matthew matthew 4096 10:42. To include details such as the file/directory permissions, owner and group (all of which are discussed later in this chapter), as well as the size, and the date and time it was last modified, enter the following: ls -alĭrwxr-xr-x 38 matthew matthew 4096 08:20. There is still more information available about each item in a directory. You can see all the hidden files by adding a switch to the command like this: ls -a. For this reason, they are not included in a basic directory listing. They are often used for configuration of specific programs and are not accessed frequently. Hidden files use filenames that start with a period (. However, using ls in this matter has some limitations. This is useful if I know what I am looking for but cannot remember the exact name. All directory listings in this chapter are abbreviated to save space.īy itself, the ls command shows just a list of names.