Here are some essential basic terminal commands that are commonly used in Linux:
1. pwd
- Purpose: Prints the current working directory.
- Usage: Simply type
pwdand press Enter. - Example:
This will display the full path of your current directory.pwd
2. ls
- Purpose: Lists the contents of a directory.
- Usage: Type
lsto see files and folders in the current directory. - Example:
You can also use options likels-lfor a detailed list or-ato include hidden files:ls -la
3. cd
- Purpose: Changes the current directory.
- Usage: Type
cdfollowed by the directory name. - Example:
To go back to the home directory, simply typecd Documentscdwithout any arguments.
4. mkdir
- Purpose: Creates a new directory.
- Usage: Type
mkdirfollowed by the name of the new directory. - Example:
mkdir new_folder
5. rmdir
- Purpose: Removes an empty directory.
- Usage: Type
rmdirfollowed by the directory name. - Example:
rmdir old_folder
6. cp
- Purpose: Copies files or directories.
- Usage: Type
cpfollowed by the source file and the destination. - Example:
cp file.txt backup_file.txt
7. mv
- Purpose: Moves or renames files or directories.
- Usage: Type
mvfollowed by the source and destination. - Example:
mv old_name.txt new_name.txt
8. cat
- Purpose: Displays the contents of a file.
- Usage: Type
catfollowed by the file name. - Example:
cat file.txt
9. grep
- Purpose: Searches for a specific pattern in files.
- Usage: Type
grepfollowed by the pattern and the file name. - Example:
grep "search_term" file.txt
10. man
- Purpose: Displays the manual for a command.
- Usage: Type
manfollowed by the command name. - Example:
man ls
These commands form the foundation of using the terminal effectively. As you practice, you'll become more comfortable with navigating and managing files in a Linux environment. If you have any specific commands you'd like to learn more about, feel free to ask!
