Repository navigation
Expand file tree
/
Copy pathbasic_bash_command.txt
More file actions
19 lines (18 loc) · 1.6 KB
/
Copy pathbasic_bash_command.txt
File metadata and controls
19 lines (18 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
##Basic bash commands:
- `ls`: List files in a folder.
- `ls -la`: List all files in a folder, including hidden files.
- `ls -l`: List files in a folder with detailed information.
- `mkdir`: Make a directory.
- `cd`: Change directory. Use file path format like `cd desktop/'Tochi Test'` to navigate to a specific directory. Use `..` to go to the parent directory and `.` to refer to the current directory.
- `echo`: Print text on the terminal.
- `>`: Redirect output to a file. For example, `echo 'Another one' > new.txt` writes "Another one" to the file `new.txt`. It can also be used to add a folder to a file, such as `echo log/ > .gitignore`. It can also overwrite the contents of a file.
- `>>`: Append text to a file. For example, `echo 'This is good' >> new.txt` adds "This is good" as a new line in the file `new.txt`.
- `cat`: Display the contents of a file on the terminal.
- `start .`: Open a folder. Using `start` followed by a file name will open the file. For example, `start new.txt` opens the file `new.txt`.
- `touch`: Create a new file.
- `pwd`: Print the current working directory.
- `--help`: Print help information for commands.
- `nano`: Edit a file in the command line using the nano text editor. For example, `nano new.txt` opens the file `new.txt` for editing.
- `rm`: Remove files and directories. Use with caution. For example, `rm file.txt` removes the file `file.txt`.
- `rm -rf`: Remove a directory and its contents recursively. Use with caution as it deletes the directory and all its files and subdirectories.
- `mv`: Move or rename files. For example, `mv file1.txt main.js` renames `file1.txt` to `main.js`.