Download Alabama Supercomputer Authority Alabama Supercomputer Authority

Transcript
HPC User Manual - 9th Edition
Working with Linux
pwd!
The “pwd” command returns the name of the current working directory.
where the current directory is in the directory tree. No arguments required.
It tells
rm!
The “rm” command removes each file in a list from a directory. For example, the file
program.cc can be deleted with the command.
rm program.cc
All of the files ending in .cc can be deleted with the command
rm *.cc
!
WARNING: Using the asterisk with the rm command can result it deleting much
more than desired. Before using rm with an asterisk, it is advisable to check a
listing of which files will be deleted with the ls command like this “ls *.cc”.
Option -i causes rm to inquire whether each file should be removed or not, like this;
rm -i *.cc
Option -r causes rm to delete a directory along with any files or directories in it. For
example;
rm -r source
rmdir
The “rmdir” command removes an empty directory from the current directory. For
example;
rmdir fort
removes the subdirectory named fort (if it contains no files).
To remove a directory and all files in that directory, either remove the files first and
then remove the directory or use the “rm -r” command described above.
42