Whether you're a developer, a student, or just curious about the command line, these basic Bash and Shell commands will help you navigate and manage files more efficiently.
TIPS
1. It’s recommended to add a space between commands and symbols, e.g.,cd .., not cd...
2. Some commands might not work in Windows PowerShell but will function in the Git Bash terminal, and vice versa. Always test in your preferred setup terminal.
File and Directory Navigation
ls
Lists all files and folders in the current directory.
ls <folder_name>
Displays all contents inside a specific folder.
cd ..
Moves up to the parent directory.
cd <folder_name>
Navigates to a specific folder. Use quotes if the folder name contains spaces, e.g., cd "My Documents".
pwd
Prints the current working directory path.
start . (Windows) or open . (Mac)
Opens the current folder in your default file explorer.
Creating Files and Folders
mkdir <folder_name>
Creates a new folder.
touch <file_name>
Creates a new file (with or without an extension), e.g., touch notes.txt.
Deleting Files and Folders
rm <file_name>
Deletes a file permanently (use with caution!).
rmdir <folder_name>
Deletes an empty folder.
⚠️ To delete a folder with contents, use rm -r <folder_name>.
System Operations
<drive_letter>: (Windows only)
Switches to a different disk drive, e.g., E: or D:.
ren <old_name> <new_name>
Renames a file or folder.
systeminfo (Windows only)
Displays detailed system information.
shutdown /s (Windows only)
Shuts down the system after a set time or immediately.
shutdown /l (Windows only)
Logs out of the current user session.
Command Management
command1 & command2
Runs multiple commands sequentially.
cls (Windows) or clear (Unix/Linux/macOS)
Clears the terminal screen.
exit
Closes the terminal session.
Final Tips
Begin your journey by reading Linux for Beginners: An Introduction to the Linux Operating System and Command Line, a great starting point for anyone new to Linux and the command line.
Practice these commands in a Git Bash terminal or Linux shell to get comfortable.
Always double-check before using destructive commands, such as
rm
.
Got questions or want to explore advanced Bash scripting? Let us know in the comments or reach out on GitHub! Happy hacking!
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.