16.5. How to Do Stuff in the Terminal¶
There are many commands we can use in the terminal to move through the filesystem of our computers. The list below shows some of the common actions programmers take.
Clicking on a link in the table will lead to a tutorial on how to use that command.
Command |
Result |
---|---|
|
Lists all files and folders in the current directory. |
|
Change directory. Navigates from the current
directory to the new |
|
Print working directory. Prints the path of the current directory. |
|
Make directory. Creates |
|
Creates a file called |
|
Removes |
|
Manual. Prints to the screen the manual pages for
the |
|
Empties the terminal window of old commands and output. |
|
Copies the file or directory at |
|
Moves the file or directory at |
Note
rm
permanently deletes items from the computer. This action cannot be undone.Git Bash does not support
man
. Instead,command --help
provides a similar result.
Beyond these basic commands, there are some shortcuts we can use in place of typing out a full path or directory name.
Shortcut |
Where it goes |
---|---|
|
The Home directory |
|
The current directory |
|
The parent directory of the current directory |
Tip
If we type the first few letters of a directory name and tap the Tab key, the terminal will often automatically complete the name for us!
$ ls
homework really_long_directory_name
README.md docs
$ cd re <-- Tap the Tab key
$ cd really_long_directory_name <-- Presto!
16.5.1. Check Your Understanding¶
Question
Which terminal command deletes a file completely from the computer?
- cp
- rm
- mv
- del
Question
Which shortcut takes you to the parent directory?
- ..
- ~
- .