Basic_Linux_Command
\#linux
Basic
Command | Description | Example |
|---|---|---|
| see the identity of your current account, and the your group memberships |
|
| To list the names of the groups that you have memberships |
|
| Display the manual page for a particular command |
|
| Clear the terminal screen |
|
| View previous commands |
|
| View aliases / Create alias |
|
| ||
| Print current directory absolute path |
|
| List files in specified directory (current directory by default) |
|
| ||
| Change your current directory location |
|
|
Quoting
Quoting | Description |
|---|---|
| Treat as normal string |
| Treat as formatted string, available variable substitution |
`...` | Run command within `` |
Operator
Operator | Description | Example |
|---|---|---|
| Comment |
|
| Environment variable |
|
| Run command within the bracket |
|
Misc.
Changes like setting variables, aliases are temporary
To make permanent, place command in
~/.bashrcfile
File Manipulation
Command | Description | Example |
|---|---|---|
| Create a file |
|
| Copy a file |
|
| ||
| Move a file |
|
| ||
| Delete a file |
|
| ||
| Make a new subdirectory |
|
| change the group owner of a file the user owns | |
| change user ownership of a file (only be used by the root user) | |
| Change permission |
|
| determine the default permissions that are set when a new file or directory is created | |
Common Option
-vto display copy process-ito prompt overwrites-nto avoid overwrites-rto copy directory structures
see more in: Linux File Ownership and Permission
Find Location
Command | Description | Example |
|---|---|---|
| Find all execute location |
|
| Find execute / binary / source file location |
|
| Find any file as long as the user has permission to access |
|
| Immediately update the locate database (normally by root user) |
|
| Search file |
|
Command | Description | Example |
|---|---|---|
| Read user input |
|
| ||
| Output the string or value of a variable |
|
| Output the strings in a file |
|
| Output the content of a file |
|
| Output first 10 line of a file |
|
| Output first 10 line of a file |
|
| ||
| View file |
|
| Output description of a file |
|
| ||
| evaluates an expression and outputs the corresponding value | |
| ||
| ||
| ||
| Search text |
|
| ||
| ||
| ||
| Word count |
|
| Cut |
|
Absolute Path
When you specify the location of a file or directory from the top level directory (called the root directory) through all of the sub directories to the file or directory.
Absolute paths start with
/.
Relative Path
When you specify the location of a file or directory relative to the current directory.
Relative paths do not start with
/.