How can I manipulate a directory in shell? Print

  • 0

There are far more commands than these but here are a few to get your started:

In order to keep track of the possibly millions of files on-line, Unix systems have a directory tree, which enables meaningful classification of files. For example, the most essential system programs are kept in /bin/, user home directories are all under /home/, and everything having to do with the WWW is under /www/. More specifically, your home directory is /home/you/ and the directory for your WWW files is /home/you/www/.

pwd

pwd This prints out your working directory: where you are. When you give a filename to a command without specifying some other directory, the filename is looked up, manipulated, or created in your current working directory.

mkdir

mkdir flintstones

This makes a subdirectory of the current directory named flintstones.

cd

cd flintstones

This changes the directory to the subdirectory named flintstones.

cd /home/domain/www/flintstones

This changes the directory to the home directory of the flintstones.

cd /home/flintstones/www

This changes the directory to the WWW directory of the flintstones.

cd

With no arguments, cd returns you to your home directory.

rmdir

rmdir flintstones This removes the subdirectory flintstones. The directory must be empty for this to work. You can use "rm -r flintstones" instead to remove the directory and all files in it.

Was dit antwoord nuttig?

« Terug