products:ict:linux:basic_commands
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| products:ict:linux:basic_commands [2022/08/29 02:09] – created - external edit 127.0.0.1 | products:ict:linux:basic_commands [2023/08/26 13:31] (current) – wikiadmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Linux Basic Commands ====== | ||
| + | |||
| + | |||
| + | |||
| [[https:// | [[https:// | ||
| Line 25: | Line 29: | ||
| On a side note, Linux’s shell is case sensitive. So, you have to type the name’s directory exactly as it is. | On a side note, Linux’s shell is case sensitive. So, you have to type the name’s directory exactly as it is. | ||
| + | |||
| + | The `cd` command in Linux is used to change the current working directory in the terminal. It allows you to navigate the file system and switch between different directories. Here's a detailed tutorial on how to use the `cd` command: | ||
| + | |||
| + | ### Basic Usage: | ||
| + | To use the `cd` command, open your terminal and follow these steps: | ||
| + | |||
| + | 1. **Open the Terminal:** You can usually find the terminal application in the Applications menu or by searching for it. | ||
| + | |||
| + | 2. **View Current Directory: | ||
| + | |||
| + | ``` | ||
| + | | ||
| + | ``` | ||
| + | |||
| + | The `~/ | ||
| + | |||
| + | 3. **Changing Directory: | ||
| + | |||
| + | | ||
| + | cd Downloads | ||
| + | ``` | ||
| + | |||
| + | If the directory name has spaces, enclose it in quotes: | ||
| + | |||
| + | | ||
| + | cd "My Documents" | ||
| + | ``` | ||
| + | |||
| + | ### Directory Paths: | ||
| + | There are several ways to specify the directory path with the `cd` command: | ||
| + | |||
| + | - **Absolute Path:** An absolute path starts from the root directory (`/`). For example: | ||
| + | |||
| + | ```bash | ||
| + | cd / | ||
| + | ``` | ||
| + | |||
| + | - **Relative Path:** A relative path starts from the current directory. For example, if you are in the `/ | ||
| + | |||
| + | ```bash | ||
| + | cd Documents | ||
| + | ``` | ||
| + | |||
| + | This takes you to `/ | ||
| + | |||
| + | - **Parent Directory (..):** You can use `..` to refer to the parent directory. For example, if you're in `/ | ||
| + | |||
| + | ```bash | ||
| + | cd .. | ||
| + | ``` | ||
| + | |||
| + | This moves you up to `/ | ||
| + | |||
| + | - **Home Directory (~):** The tilde (`~`) symbol represents your home directory. For example: | ||
| + | |||
| + | ```bash | ||
| + | cd ~/Downloads | ||
| + | ``` | ||
| + | |||
| + | This takes you to `/ | ||
| + | |||
| + | ### Special Directories: | ||
| + | There are a few special directory shortcuts you can use with `cd`: | ||
| + | |||
| + | - **`-`:** Use a single hyphen (`-`) to switch to the previous directory you were in. | ||
| + | |||
| + | - **`.`:** A single dot (`.`) represents the current directory. This is often used when you want to refer to the current directory explicitly. | ||
| + | |||
| + | ### Tips and Shortcuts: | ||
| + | - Pressing the `Tab` key while typing a directory name auto-completes it. This is useful when dealing with long directory names. | ||
| + | |||
| + | - You can use the `Tab` key twice to see a list of available options if the directory name is ambiguous. | ||
| + | |||
| + | - The `cd` command without any arguments takes you to your home directory. | ||
| + | |||
| + | ### Examples: | ||
| + | Here are a few more examples of using the `cd` command: | ||
| + | |||
| + | 1. Move to the parent directory: | ||
| + | | ||
| + | cd .. | ||
| + | ``` | ||
| + | |||
| + | 2. Move to the root directory: | ||
| + | | ||
| + | cd / | ||
| + | ``` | ||
| + | |||
| + | 3. Move to a directory with spaces: | ||
| + | | ||
| + | cd "My Documents" | ||
| + | ``` | ||
| + | |||
| + | 4. Move to a subdirectory within the current directory: | ||
| + | | ||
| + | cd Subfolder | ||
| + | ``` | ||
| + | |||
| + | 5. Go back to the previous directory: | ||
| + | | ||
| + | cd - | ||
| + | ``` | ||
| + | |||
| + | Remember that the `cd` command only changes the current working directory within the terminal session. It doesn' | ||
| + | |||
| + | |||
| **ls command** | **ls command** | ||
products/ict/linux/basic_commands.1661720954.txt.gz · Last modified: 2022/08/29 02:09 by 127.0.0.1