Difference between revisions of "BasicLinuxCommands"
Arif Iqbal (talk | contribs) |
|||
|
(2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | There are some of the basic shell commands that you will need. | + | There are some of the basic shell commands that you will need. You can type in the following command to see detailed documentation for any command. |
| − | + | <pre> | |
| − | + | man <command> | |
| − | + | </pre> | |
| − | |||
| − | * | + | * View directory listing. |
| − | + | <pre> | |
| − | + | ls (list directory contents) | |
| − | + | ls -l (verbose directory listing) | |
| + | ls -ltrh (verbose directory listing, sorted in reverse order (r) | ||
| + | according to time (t), file sizes displayed in | ||
| + | human-readable format (h)) | ||
| + | </pre> | ||
| − | * | + | * Create/remove directory. |
| − | + | <pre> | |
| − | + | mkdir dir_name (make a directory called dir_name) | |
| + | rmdir dir_name (remove directory dir_name. dir_name must be empty) | ||
| + | </pre> | ||
| − | * | + | * Copy/move files and directories. |
| − | + | <pre> | |
| − | + | cp file_name copy_file_name (copies file_name to copy_file_name) | |
| − | + | mv file_name new_file_name (moves file_name to new_file_name) | |
| + | cp -R * dest (copies all files and directories in the current | ||
| + | working directory to a destination directory) | ||
| + | </pre> | ||
| − | * | + | * Delete files and directories. |
| − | + | <pre> | |
| − | + | rm file_name (remove (delete) file_name) | |
| + | rm -f file_name (force delete file_name) | ||
| + | rm -rf * (force delete all files and directories) | ||
| + | </pre> | ||
| − | * | + | * Dump file contents on screen. Actually concatenates files and print on standard output. |
| − | + | <pre> | |
| + | cat file_name (view the contents of file_name) | ||
| + | cat file1 file2 file3 ... (cat also works for multiple files) | ||
| + | </pre> | ||
| + | |||
| + | * Find out current working directory | ||
| + | <pre> | ||
| + | pwd (print name of current working directory) | ||
| + | </pre> | ||
Latest revision as of 04:15, 28 October 2008
There are some of the basic shell commands that you will need. You can type in the following command to see detailed documentation for any command.
man <command>
- View directory listing.
ls (list directory contents) ls -l (verbose directory listing) ls -ltrh (verbose directory listing, sorted in reverse order (r) according to time (t), file sizes displayed in human-readable format (h))
- Create/remove directory.
mkdir dir_name (make a directory called dir_name) rmdir dir_name (remove directory dir_name. dir_name must be empty)
- Copy/move files and directories.
cp file_name copy_file_name (copies file_name to copy_file_name) mv file_name new_file_name (moves file_name to new_file_name) cp -R * dest (copies all files and directories in the current working directory to a destination directory)
- Delete files and directories.
rm file_name (remove (delete) file_name) rm -f file_name (force delete file_name) rm -rf * (force delete all files and directories)
- Dump file contents on screen. Actually concatenates files and print on standard output.
cat file_name (view the contents of file_name) cat file1 file2 file3 ... (cat also works for multiple files)
- Find out current working directory
pwd (print name of current working directory)
