标签:
By performing this lab, students will learn how to navigate and manage files and directories.
In this lab, you will perform the following tasks:
In this task you will explore the concepts of files and directories.
On a Linux OS, data is stored in files and files are stored in directories. You may be used to the term folders to describe directories.
Directories are actually files, too; the data that they hold are the names of the files that have been entered into the them, along with the inode number (a unique identifier number assigned to each file) for where the data for that file exists on the disk.
As a Linux user, you will want to know how to manipulate these files and directories, including how to list files in a directory, copy, delete and move files.
Type the following command to print the working directory:
[zhangqiwei@network ~]$ pwd
/home/zhangqiwei
The working directory is the directory that your terminal window is currently "in". This is also called the current directory. This will be important for when you are running future commands as they will behave differently based on the directory you are currently in.
When you first open a terminal window, you will be placed in your home directory. This is a directory where you have full access and other users normally have no access by default. To see the path to your home directory, you can execute the following command to view the value of the HOME variable:
[zhangqiwei@network ~]$ echo $HOME /home/zhangqiwei
You can use the cd
command with a path to a directory to change your current directory. Type the following command to make the root directory your current working directory and verify with the pwd
command:
[zhangqiwei@network ~]$ cd / [zhangqiwei@network /]$ pwd /
To change back to your home directory, the cd command can be executed without a path. Change back to your home directory and verify by typing the following commands:
[zhangqiwei@network /]$ cd [zhangqiwei@network ~]$ pwd /home/zhangqiwei
Use the echo
command below to display some other examples of using the tilde as part of path:
[zhangqiwei@network ~]$ echo ~ zhangqiwei ~root ~mail ~nobody /home/zhangqiwei zhangqiwei /root /var/spool/mail /
Lab - Listing Files and Directories
标签:
原文地址:http://www.cnblogs.com/elewei/p/4817665.html