Note, that this recipe is not updated long time and could be outdated!
Got it.

Command line terminal

Command terminal is useful program for advanced system configuration and diagnostics. Great benefit of textual commands is that they are much easier to document and execute (manually or automatically).

Content

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:

  1. gnome-terminal (for Ubuntu)
    or
    xfce4-terminal (for Xubuntu)
  2. Press Enter

D: Press Ctrl+Alt+t key combination (may not work in any environment and settings)

It should opening window like this:

terminal.png

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

  1. If no specific comments are added, commands written in separate lines should be executed one-by-one. For example:

    cd ~
    ls

    should be executed in following way:

    1. type cd ~ and press Enter
    2. type ls and press Enter
  2. 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 ~;
    ls

    can be entered and executed by pressing Enter at the end all at once.

  3. 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 \
    -la

    have 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

  1. Previous command can be called by up arrow key in terminal, and executed by pressing Enter.
  2. 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  history
  3. For 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-
  4. 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.

  
Tags Ubuntu Rīki Uzturēšana Teksts English
Created by Valdis Vītoliņš on 2017-03-03 19:12
Last modified by Valdis Vītoliņš on 2020-11-20 19:50
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License