Difference between revisions of "Linux commands"
(Created page with "This page details some common and useful Linux commands ==Miscellany== * <code>exit</code> - end the terminal session * <code>clear</code> - clear the terminal screen * <code...") |
|||
Line 8: | Line 8: | ||
==Command information== | ==Command information== | ||
* <code>man ''command''</code> - read the manual page for <code>''command''</code> | * <code>man ''command''</code> - read the manual page for <code>''command''</code> | ||
− | |||
==Paths== | ==Paths== |
Revision as of 00:43, 16 January 2018
This page details some common and useful Linux commands
Miscellany
-
exit
- end the terminal session -
clear
- clear the terminal screen -
history
- view your command history
Command information
-
man command
- read the manual page forcommand
Paths
In every file system files are organized into various folders or directories. A path describes the location of a file or directory and can be relative or absolute. For instance, suppose a file system has the following folders:
-
/
-
/dirA
-
/dirB
-
/dirB/files
If we wish to examine a file listing of /dirB/files
and our current directory is /dirB
then we can issue the command ls files
(relative path) or /dirB/files
(absolute path)
Additionally, there are special symbols with respect to paths that can be used:
-
.<code> - current directory
- <code>..<code> - parent directory (one level up)
- <code>~<code> - home directory
- <code>pwd - print the current directory you are in
-
ls
- list files in the current directory -
ls -l
- list files with complete details in the current directory -
ls -a
- list all files in the current directory (including hidden files starting with.
) -
ls directory
- list files indirectory
-
cd directory
- makedirectory
the current directory -
cd ..
- make the parent directory the current directory -
cd
- make your home directory the current directory -
mkdir directory
- create a subdirectory -
rmdir directory
- remove a directory (only if empty) -
rm filename
- remove a file -
rm -rf directory
- delete a directory and all contents within -
rm *
- remove all files in the current directory -
mv file1 file2
- move and/or renamefile1
tofile2
-
cp file1 file2
- copyfile1
tofile2