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...") |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
This page details some common and useful Linux commands | This page details some common and useful Linux commands | ||
+ | |||
+ | A full cheatsheet can be found at https://tux.cs.unlv.edu/refs/linux_commands.html | ||
==Miscellany== | ==Miscellany== | ||
Line 8: | Line 10: | ||
==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== | ||
Line 22: | Line 23: | ||
Additionally, there are special symbols with respect to paths that can be used: | Additionally, there are special symbols with respect to paths that can be used: | ||
− | * <code>.<code> - current directory | + | * <code>.</code> - current directory |
− | * <code>..<code> - parent directory (one level up) | + | * <code>..</code> - parent directory (one level up) |
− | * <code>~<code> - home directory | + | * <code>~</code> - home directory |
==Navigation== | ==Navigation== | ||
Line 42: | Line 43: | ||
* <code>mv ''file1'' ''file2''</code> - move and/or rename <code>''file1''</code> to <code>''file2''</code> | * <code>mv ''file1'' ''file2''</code> - move and/or rename <code>''file1''</code> to <code>''file2''</code> | ||
* <code>cp ''file1'' ''file2''</code> - copy <code>''file1''</code> to <code>''file2''</code> | * <code>cp ''file1'' ''file2''</code> - copy <code>''file1''</code> to <code>''file2''</code> | ||
+ | ** Both <code>cp</code> and <code>mv</code> will overwrite the destination file if it already exists |
Latest revision as of 14:54, 4 September 2018
This page details some common and useful Linux commands
A full cheatsheet can be found at https://tux.cs.unlv.edu/refs/linux_commands.html
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:
-
.
- current directory -
..
- parent directory (one level up) -
~
- home directory
-
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
- Both
cp
andmv
will overwrite the destination file if it already exists
- Both