码迷,mamicode.com
首页 > 其他好文 > 详细

Lab - Listing Files and Directories

时间:2015-09-17 23:00:58      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:

By performing this lab, students will learn how to navigate and manage files and directories.

 

In this lab, you will perform the following tasks:

  1. List files and directories
  2. Copy, move and delete files and directories

 

Part 1: Files and Directories

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.

 

Step 1

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

 

 

Step 2

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

 

 

Step 3

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!