Working with Directories

Many Linux commands for working with files also apply to directories. For instance, chown, chmod, cp, mv, rm, and In (with some restrictions on some of these commands) all apply to directories. Directories present their own unique needs, though. For instance, you need a special command to create a directory. Some directory-centric commands include:

mkdir This command creates a new directory, as in mkdir reports to create a directory called reports.

rmdir This command deletes an empty directory. If you want to delete a directory tree that contains files, you're better off using rm -r.

cd This command changes the current working directory. For instance, typing cd /etc moves you into the /etc directory, so that you can more easily work on files in this directory.

pwd This command displays the current working directory, so that you know where you're working.

0 0

Post a comment