The most frequent tasks that you perform on your PC is creating, moving or deleting Files. Let's look at various options for File Management.
Save the file, and your changes should show up immediately, even with the Windows Terminal open. How to Change Default Key Bindings. The first section pertains key bindings if you don’t like a particular keyboard shortcut you can change those here. For instance, if you want Ctrl+e to close tabs, you would find this section. Yet another cmd.exe is a stripped-down shell for Windows CE 3.0. An MS-DOS type interpreter called PocketDOS has been ported to Windows CE machines; the most recent release is almost identical to MS-DOS 6.22 and can also run Windows 1, 2, and 3.0, QBasic and other development tools, 4NT and 4DOS. The latest release includes several shells.
To manage your files, you can either use
- Terminal (Command Line Interface - CLI)
- File manager (Graphical User Interface -GUI)
In this tutorial, you will learn-
Click here if the video is not accessible
![Terminal keyboard shortcuts Terminal keyboard shortcuts](https://code.visualstudio.com/assets/docs/editor/integrated-terminal/integrated-terminal.png)
Why learn Command Line Interface?
Even though the world is moving to GUI based systems, CLI has its specific uses and is widely used in scripting and server administration. Let's look at it some compelling uses -- Comparatively, Commands offer more options & are flexible. Piping and stdin/stdout are immensely powerful are not available in GUI
- Some configurations in GUI are up to 5 screens deep while in a CLI it's just a single command
- Moving, renaming 1000's of the file in GUI will be time-consuming (Using Control /Shift to select multiple files), while in CLI, using regular expressions so can do the same task with a single command.
- CLI load fast and do not consume RAM compared to GUI. In crunch scenarios this matters.
Both GUI and CLI have their specific uses. For example, in GUI, performance monitoring graphs give instant visual feedback on system health, while seeing hundreds of lines of logs in CLI is an eyesore.
You must learn to use both GUI(File Manager) and CLI (Terminal)
GUI of a Linux based OS is similar to any other OS. Hence, we will focus on CLI and learn some useful commands.
Launching the CLI on Ubuntu
There are 2 ways to launch the terminal.
1) Go to the Dash and type terminal
2) Or you can press CTRL + Alt + T to launch the Terminal
Once you launch the CLI (Terminal), you would find something as guru99@VirtualBox(see image) written on it.
1) The first part of this line is the name of the user (bob, tom, ubuntu, home..)
2) The second part is the computer name or the host name. The hostname helps identify a computer over the network. In a server environment, host-name becomes important.
3) The ':' is a simple separator
4) The tilde '~' sign shows that the user in working in the home directory. If you change the directory, this sign will vanish.
In the above illustration, we have moved from the /home directory to /bin using the 'cd' command. The ~ sign does not display while working in /bin directory. It appears while moving back to the home directory.
5) The '$' sign suggests that you are working as a regular user in Linux. While working as a root user, '#' is displayed.
Present Working Directory
The directory that you are currently browsing is called the Present working directory. You log on to the home directory when you boot your PC. If you want to determine the directory you are presently working on, use the command -
pwd command stands for print working directory
Above figure shows that /home/guru99 is the directory we are currently working on.
Changing Directories
If you want to change your current directory use the 'cd' command.
Consider the following example.
Here, we moved from directory /tmp to /bin to /usr and then back to /tmp.
Navigating to home directory
If you want to navigate to the home directory, then type cd.
You can also use the cd ~ command.
Moving to root directory
The root of the file system in Linux is denoted by '/'. Similar to 'c:' in Windows.
Note: In Windows, you use backward slash ' while in UNIX/Linux, forward slash is used '/'
Type 'cd /' to move to the root directory.
TIP: Do not forget space between cd and /. Otherwise, you will get an error.
Navigating through multiple directories
You can navigate through multiple directories at the same time by specifying its complete path.
Example: If you want to move the /cpu directory under /dev, we do not need to break this operation in two parts.
Instead, we can type '/dev/cpu' to reach the directory directly.
Terminal 1 0 1 – Your Terminal Shortcut Keys
Moving up one directory level
For navigating up one directory level, try.
Here by using the 'cd .' command, we have moved up one directory from '/dev/cpu' to '/dev'.
Then by again using the same command, we have jumped from '/dev' to '/' root directory.
Relative and Absolute Paths
A path in computing is the address of a file or folder.
Example - In WindowsIn Linux
There are two kinds of paths:
1. Absolute Path:
Let's say you have to browse the images stored in the Pictures directory of the home folder 'guru99'.
The absolute file path of Pictures directory /home/guru99/Pictures
![Mac open terminal shortcut Mac open terminal shortcut](https://media.cheatography.com/storage/thumb/alexandreceolin_tmux-terminal-multiplexer.750.jpg?last=1601592941)
To navigate to this directory, you can use the command.
This is called absolute path as you are specifying the full path to reach the file.
2. Relative Path:
The Relative path comes in handy when you have to browse another subdirectory within a given directory.
Terminal Keyboard Shortcuts
It saves you from the effort to type complete paths all the time.
Suppose you are currently in your Home directory. You want to navigate to the Downloads directory.
You do no need to type the absolute path
Instead, you can simply type 'cd Downloads' and you would navigate to the Downloads directory as you are already present within the '/home/guru99' directory.
This way you do not have to specify the complete path to reach a specific location within the same directory in the file system.
Summary:
- To manage your files, you can use either the GUI(File manager) or the CLI(Terminal) in Linux. Both have its relative advantages. In the tutorial series, we will focus on the CLI aka the Terminal
- You can launch the terminal from the dashboard or use the shortcut key Cntrl + Alt + T
- The pwd command gives the present working directory.
- You can use the cd command to change directories
- Absolute path is complete address of a file or directory
- Relative path is relative location of a file of directory with respect to current directory
- Relative path help avoid typing complete paths all the time.
Command | |
---|---|
cd or cd ~ | Navigate to HOME directory |
cd . | Move one level up |
cd | To change to a particular directory |
cd / | Move to the root directory |
Terminal User Guide
Use these shortcuts to save time when using Terminal.
Work with Terminal windows and tabs
Windows Terminal Shortcuts
Action | Shortcut |
---|---|
New window | Command-N |
New window with same command | Control-Command-N |
New tab | Command-T |
New tab with same command | Control-Command-T |
Show or hide tab bar | Shift-Command-T |
Show all tabs or exit tab overview | Shift-Command-Backslash () |
New command | Shift-Command-N |
New remote connection | Shift-Command-K |
Show or hide Inspector | Command-I |
Edit title | Shift-Command-I |
Edit background color | Option-Command-I |
Make fonts bigger | Command-Plus (+) |
Make fonts smaller | Command-Minus (–) |
Next window | Command-Grave Accent (`) |
Previous window | Command-Shift-Tilde (~) |
Next Tab | Control-Tab |
Previous Tab | Control-Shift-Tab |
Split window into two panes | Command-D |
Close split pane | Shift-Command-D |
Close tab | Command-W |
Close window | Shift-Command-W |
Close other tabs | Option-Command-W |
Close all | Option-Shift-Command-W |
Scroll to top | Command-Home |
Scroll to bottom | Command-End |
Page up | Command-Page Up |
Page down | Command-Page Down |
Line up | Option-Command-Page Up |
Line down | Option-Command-Page Down |
Edit a command line
Action | Shortcut |
---|---|
Reposition the insertion point | Press and hold the Option key while moving the pointer to a new insertion point. |
Move the insertion point to the beginning of the line | Control-A |
Move the insertion point to the end of the line | Control-E |
Move the insertion point forward one character | Right Arrow |
Move the insertion point backward one character | Left Arrow |
Move the insertion point forward one word | Option-Right Arrow |
Move the insertion point backward one word | Option-Left Arrow |
Delete to the beginning of the line | Control-U |
Delete to the end of the line | Control-K |
Delete forward to the end of the word | Option-D (available when Use Option as Meta key is selected) |
Delete backward to the beginning of the word | Control-W |
Delete one character | Delete |
Forward-delete one character | Forward Delete (or use Fn-Delete) |
Transpose two characters | Control-T |
Open Terminal Shortcut
Select and find text in a Terminal window
Action | Shortcut |
---|---|
Select a complete file path | Press and hold the Shift and Command keys and double-click the path |
Select a complete line of text | Triple-click the line |
Select a word | Double-click the word |
Select a URL | Press and hold the Shift and Command keys and double-click the URL |
Select a rectangular block | Press and hold the Option key and drag to select text |
Cut | Command-X |
Copy | Command-C |
Copy without background color | Control-Shift-Command-C |
Copy plain text | Option-Shift-Command-C |
Paste | Command-V |
Paste the selection | Shift-Command-V |
Paste escaped text | Control-Command-V |
Paste escaped selection | Control-Shift-Command-V |
Find | Command-F |
Find next | Command-G |
Find previous | Command-Shift-G |
Find using the selected text | Command-E |
Jump to the selected text | Command-J |
Select all | Command-A |
Open the character viewer | Control-Command-Space |
Work with marks and bookmarks
Action | Shortcut |
---|---|
Mark | Command-U |
Mark as bookmark | Option-Command-U |
Unmark | Shift-Command-U |
Mark line and send return | Command-Return |
Send return without marking | Shift-Command-Return |
Insert bookmark | Shift-Command-M |
Insert bookmark with name | Option-Shift-Command-M |
Jump to previous mark | Command-Up Arrow |
Jump to next mark | Command-Down Arrow |
Jump to previous bookmark | Bloom 1 0 57 download free. Option-Command-Up Arrow |
Jump to next bookmark | Option-Command-Down Arrow |
Clear to previous mark | Command-L |
Clear to previous bookmark | Option-Command-L |
Clear to start | Command-K |
Select between marks | Shift-Command-A |
Other shortcuts
Action | Shortcut |
---|---|
Enter or exit full screen | Control-Command-F |
Show or hide colors | Shift-Command-C |
Open Terminal preferences | Command-Comma (,) |
Break | Typing Command-Period (.) is equivalent to entering Control-C on the command line |
Print | Command-P |
Soft reset terminal emulator state | Option-Command-R |
Hard reset terminal emulator state | Control-Option-Command-R |
Open a URL | Hold down the Command key and double-click the URL |
Add the complete path to a file | Drag the file from the Finder into the Terminal window |
Export text as | Command-S |
Export selected text as | Shift-Command-S |
Reverse search command history | Control-R |
Toggle “Allow Mouse Reporting” option | Command-R |
Toggle “Use Option as Meta Key” option | Command-Option-O |
Show alternate screen | Option-Command-Page Down |
Hide alternate screen | Option-Command-Page Up |
Open man page for selection | Control-Shift-Command-Question Mark (?) |
Search man page index for selection | Control-Option-Command-Slash (/) |
Complete directory or file name | On a command line, type one or more characters, then press Tab |
Display a list of possible directory or file name completions | On a command line, type one or more characters, then press Tab twice |
See alsoCreate custom function keys in Terminal on MacChange Profiles Keyboard preferences in Terminal on MacApple Support article: Mac keyboard shortcuts