Command line terminal
Content
- How to start terminal
- Copying and pasting commands
- How to execute commands from recipes
- Stop execution
- Stop data stream
- Looking for and executing commands from history
How to start terminal
A: In Ubuntu click on (home) button, enter term and select Terminal icon
B: In Xubuntu select start menu and choose Accessories — Terminal Emulator
C: Press Alt+F2 key combination and in opened dialogue window enter:
- gnome-terminal (for Ubuntu)
or
xfce4-terminal (for Xubuntu) - Press Enter
D: Press Ctrl+Alt+t key combination (may not work in any environment and settings)
It should opening window like this:
Copying and pasting commands
In terminal window copying pasting is done with following key combinations:
- Ctrl+Insert to copy,
- Shift+Insert to paste
- or right-click mouse button and select Copy or Paste in context menu
Don't blindly copy-paste random commands from the internet!
How to execute commands from recipes
If no specific comments are added, commands written in separate lines should be executed one-by-one. For example:
cd ~
lsshould be executed in following way:
- type cd ~ and press Enter
- type ls and press Enter
If lines (commands) are finished with semicolon ; (that notes end of command), then commands can be entered by copying and pasting and executing all lines together. For example:
cd ~;
lscan be entered and executed by pressing Enter at the end all at once.
If lines with commands end with backslash \ (that notifies to ignore line breaks), then commmands have to be copied and pasted all together. In important places that is usually mentioned in comments, for example: "copy, paste and execute all commands together!", but in general you should look at backslashes in the end of command lines:
ls \
-lahave to be entered and executed all at once.
Stop execution
Some commands like top, tail -f run execution until interrupted. To stop these commands, press Ctrl+c keys.
Stop data stream
If command reads data stream from input, signalize end of data stream pressing Ctrl+d keys.
Looking for and executing commands from history
- Previous command can be called by up arrow key in terminal, and executed by pressing Enter.
Previous commands can be viewed by entering command history. For example it could show:
20206 echo "My secret"|sha256sum|xxd -r -p|base64|cut -b -4|tr "+/=" "abc"
20207 historyFor documentation purposes useful command is history|cut -b 8-, whic cuts off first 8 characters with number of commapds. For example, it could show:
echo "My secret"|sha256sum|xxd -r -p|base64|cut -b -4|tr "+/=" "abc"
history
history|cut -b 8-- Commands can be searched in history by pressing Ctrl+r and then entering start of the command. When necessary command is show in terminal, press Enter.
Created by Valdis Vītoliņš on 2017-03-03 19:12
Last modified by Valdis Vītoliņš on 2020-11-20 19:50