-
Introduction to Basic Terminal/Bash Commands
If you're new to programming or system administration, you might be intimidated by the command line interface (CLI) and the terminal or bash shell. However, learning a few basic commands can help you navigate and control your computer more efficiently and effectively. In this tutorial, we'll introduce you to some of the most essential terminal/bash commands and show you how to use them with examples. Here are some of the most basic commands you'll need to know:
-
pwd
: Prints the current working directory (folder). For example,pwd
displays the path of the current directory, such as/Users/John/Documents
. -
ls
: Lists the contents of the current directory (folder). For example,ls /Users/John/Desktop
lists the files and folders on John's desktop. -
cd
: Changes the current directory to the specified directory. For example,cd /Users/John/Documents
changes the current directory to John's Documents folder. -
mkdir
: Creates a new directory with the specified name. For example,mkdir my-folder
creates a new folder named "my-folder" in the current directory. -
touch
: Creates a new empty file with the specified name. For example,touch my-file.txt
creates a new file named "my-file.txt" in the current directory. -
rm
: Removes (deletes) the specified file or directory. For example,rm my-file.txt
deletes the file "my-file.txt" in the current directory. To delete a directory and its contents, use ther
(recursive) option, like this:rm -r my-folder
.These are just a few of the most basic commands you'll need to know. As you become more comfortable with the terminal/bash shell, you'll learn many more commands and options that can help you work more efficiently and automate tasks.
Learn more: Bash/Terminal commands (opens in a new tab)
-