What can you do from the terminal? Linux Terminal Commands

If you are not completely new to Ubuntu and have already become somewhat familiar with your system, then you probably use the terminal quite often. Modern systems Linux allows you to do almost anything with graphic utilities from software installation to fine tuning systems. But the terminal also does not lose its relevance. With a sufficient level of knowledge, actions in the terminal are performed much faster and more efficiently.

For example, you do not need to search for menu items, click the mouse several times, search for a program in the system, and so on. It is enough just to type one command, send it required parameters and the computer will do everything necessary actions. Simple and fast. The situation is still being done more interesting possibilities combinations of commands, redirecting the output of one command to another, and so on. But the topic of our article today is not the capabilities of the Linux terminal, but setting up the terminal in Ubuntu.

First we'll look at how to improve appearance and the convenience of using the default terminal emulator in Ubuntu - Gnome Terminal, and then we will look at how to improve the command shell.

You can launch the terminal from the main menu or by pressing the keyboard shortcut Ctrl+Alt+T:

By default, the terminal does not look very nice in the system. But the situation can be corrected by installing another Unity theme, for example, Numix:

But this article will discuss manual setting Ubuntu terminal, without installing themes. To customize the appearance of the terminal, open context menu, by clicking in any area of ​​the terminal, open the item Profiles and select Profile Options:

On the Basic tab, you can configure the size of the terminal window, as well as the font:

To customize the font, check the Use a different font checkbox and select desired font from the list, for example, Dejavu Sans Mono Book:

The most interesting tab for us is the Colors tab, here we will select the colors we need for the terminal window, and also adjust the transparency. But to unlock the setting, uncheck Use colors from system theme:

Here you can choose one of the existing color schemes, but I didn’t like any of them, so we’ll customize our own. The desired color is in the field text color And background color. I have it in light gray and dark gray. You can also add a little transparency using the slider, or simply check the Use system theme transparency checkbox:

Now the terminal looks quite acceptable, but that's not all. I would like to talk more about the command shell.

Setting up the Ubuntu shell

By default, Ubuntu uses command shell Bash. It was invented back in the 80s for the Unix operating system at Bell Labs. It is clear that since then it has been modified and greatly improved, a free implementation of Bash has been written, which you now use, and so on. But all the principles remain the same.

During this time, better shells have been developed that provide users with a much friendlier interface and are more convenient to use and write scripts.

One such shell is fish, or Frendly Interactive Shell. Let's take a brief look at its advantages. Very important point fish has full syntax highlighting, each correctly entered command is highlighted in one color, unknown to others, and the correct path to the file is underlined, so you immediately understand whether you typed the command correctly, without even pressing Enter. It's also very convenient search previously entered commands in the history, just type the first few characters of the command and start scrolling up with the button to see all previously entered commands starting with these characters. Moreover, when you start typing a command, the shell offers you the last executed command starting with such characters, just press the right arrow, and the command is ready to run. Autocompletion here is much better than in Bash, fish completes not only commands and file addresses, but also command options, and this can be very useful for beginners.

And there’s no need to talk about Fish scripts at all, they are much lighter and simpler. Much easier for beginners to learn and easier for experienced users, because the Bash scripts famous for their complexity.

If you are not yet sure whether you need to install the Fish shell on your system, no one is forcing you to uninstall Bash, you can just install fish and check its capabilities, you may also like it. Setting up the Ubuntu console should include installing a normal shell.

To install Fish on Ubuntu, type:

sudo apt install fish

You can test the shell without replacing it for your terminal by simply running:

If you want this shell to be used by default, open Profile Options, and go to the tab and there check Run command as a login shell and Run another command instead of my shell. Then in the field write the address of the fish shell file: /usr/bin/fish:

Now let's customize it a little new shell. As you have already seen, at startup a message is displayed that you need to click help to get help, I suggest removing it.

To change the invitation do:

set fish_greeting "Have a lot of fun"

You can not send any phrase, and then the invitation will remain empty.

Fish does not have a .bashrc file. But there is a directory with settings and functions ~/.config/fish/. There you will find all the functions that can be called from the shell, and you can also add your own functions there, for example, create an alias for the rm command using the function:

vi .config/fish/functions/rm.fish

function rmi
rm -i $argv
end

Of course, as before, it is still possible to use the command:

alias rmi "rm -i"

It needs to be added to the end of the .config/fish/config.fish file

Another great feature of this shell is the ability to configure it through a graphical interface. Just type:

In the browser window that opens, you can very easily customize the overall color scheme, as well as the greeting format, without delving into bash terms and color codes.

Yakuake is a terminal that appears at the top of the screen. Supports tabs and window splitting across multiple terminals.

  • Cool Retro Term is a terminal for Linux in the old tube style. Has several design themes. Allows you to customize the appearance.

  • QTerminal is a lightweight terminal with the ability to open multiple terminals in one window. Drop-down window mode is supported.

  • Betty

    Betty is a program that allows you to various commands Linux, but to execute them you don't need to know the commands themselves, you can just write what you want in plain English.

  • Final Term is a modern terminal emulator for Linux that has interactive features and capabilities that others don't have similar programs. The program has convenient command completion, recognizes files, addresses and other elements, supports collapsing commands, customizable hotkeys, themes and much more.

  • Gnome Terminal is the standard terminal for the Gnome desktop environment. It works stably, has the necessary capabilities and settings for everyday work. Supports color schemes, color text output, tabs and so on.

  • Terra Terminal Emulator - a terminal for Linux that drops out (appears) at the top of the screen when pressed hotkey(default F12). You can create several tabs and each tab has several terminals. The terminal window itself is transparent.

  • ASCIIQuarium - small console program(Perl script) displaying its own ASCII animation of a virtual pond with its inhabitants.

  • Since the creation of the Linux operating system, the main method of working in it has been the Command Line Interface. Later, graphical details were added to this universal tool, modernizing the system and making it more convenient for new users. Despite the friendly environment of many Linux distributions, using the CLI (Command Line) is still justified. Ubuntu Terminal Commands are a feature for integrated management PC resources using instructions of varying length and complexity. That's why mastering the Terminal is so important.

    Basic text commands to perform tasks through the terminal.

    Teams can consist of the most different characters- numbers, letters, hyphens and dashes easily coexist in them. They are entered line by line. The execution of each instruction begins when you click on Enter key or other similar method. The Terminal interface is useful in that it will be available even if the graphic part fails. It interacts directly with the OS kernel.

    This method of entering instructions is unusually flexible, it does not require much hardware and software resources. Autorun commands are also supported.

    More precisely, the Terminal is a Console emulator. It supports the same features, while offering some additional ones. You can launch it using the keyboard shortcut “Ctrl + Alt + T”.

    Instructions for the Terminal are a pre-created list of characters, after typing and confirming which the PC will execute in advance given command. In this case, additional parameters can be taken into account.

    As a rule, a command (instruction) consists of three parts:

    1. App name. This name executable file, which is already recorded in the system as a variable.
    2. Key. Keys are used for more precise directions. They allow you to perform specific action or algorithm.
    3. Meaning. This is some variable, a parameter for the key.

    This is how instructions for a computer running Linux are generated. Basic commands Ubuntu is used to work with files and directories, run programs and administer the system, as well as much more. Let's talk about them in more detail.

    Working with files and directories

    Create file:

    touch filename

    If you need to make changes to the creation date and time, the following command will help:

    touch -t 0712250000 fileditest

    Delete a file:

    rm filename

    Forced file deletion:

    Create a copy of the file in another file:

    Show file contents:

    This way you can display 10 lines of a file from the beginning...:

    ...and so - from the end:

    rsync -rogpav -e ssh –delete /home ip_address:/tmp

    This is how you can create a copy local disk in the file on remote computer(syntax example):

    dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr ‘dd of=hda.gz’

    This way you can search a folder for all files with the extension “.txt” and copy them to a directory under a different address:

    find /home/user1 -name ‘*.txt’ | xargs cp -av –target-directory=/home/backup/ –parents

    Managing users and groups

    Now let's talk about instructions that help manage user rights. Without these instructions, basic Ubuntu commands would be incomplete. As a rule, they are needed to change the password, create and delete groups and individuals using the OS.

    Create new group with the given name:

    Delete a group with a given name:

    Change group name:

    groupmod -n new_group_name old_group_name

    Create a new user:

    Erase user data, including his personal directory:

    Set new attributes for the user:

    usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1

    Install New Password current account:

    Edit the password of the specified user. Applies only with root rights:

    Other Useful Commands

    In the operating system Ubuntu team a reboot via Terminal can be applied even if the GUI is not running. Here she is:

    Other commands can also be used:

    sudo init 6
    sudo shutdown -r now

    To shut down your PC, you can use these instructions:

    sudo poweroff
    sudo telenit 0
    sudo halt
    sudo shutdown -h now

    End the current session:

    In conclusion

    We looked at the Ubuntu shutdown command and various syntax constructs, ways to launch operations with packages and techniques for working with archives... We hope that all the tools described here will seriously help you in obtaining a bright and useful user experience.

    Today, many graphical utilities have been developed to perform operations in the Linux OS, making it easier to configure and work with the system.

    Undoubtedly, it is very convenient and useful, especially for people who are just starting to learn Linux.

    However, knowledge of basic terminal commands is essential for anyone dealing with the OS.

    Linux terminal command syntax and help commands

    In the very general view Linux terminal command syntax can be written as:

    Command [options] [files/folders]
    where options (often called keys) specify parameters that affect the execution of the command, and files and folders are the objects to which the command's action is directed.

    Because for different teams the same key can mean different actions, it is not possible to describe all the keys. To obtain information about the command, you can use the --help switch, which is universal for most commands.

    For extended help about a command, you can use the man or info command.

    Using the –version option, you can find out the version number of the command. Examples of getting help for the main Linux terminal command - ls:

    Ls --help ls --verison man ls infols
    So you can easily get necessary information about the syntax, options and actions of the command.

    Regular users have limited opportunities when executing Linux terminal commands.

    By default, users can perform operations on objects that they own. The user, in order to perform operations on other people’s objects, as well as operations that make changes to the system that affect all users, must obtain the appropriate rights to the operation object or run them as superuser(root), which has unlimited rights when executing terminal commands.

    To obtain superuser rights without logging out of the system, you need to execute the terminal command su and enter root password.

    It is worth canceling that all users who know the root password, in fact, have all the rights in the system. If there is a need to give users the ability to perform operations on behalf of the superuser and at the same time limit freedom of action, you can use the sudo command, having previously configured the list of allowed operations and available files, for each user.

    Exact information The best way to view how sudo works is in each individual distribution by calling its help.

    When running sudo, the user is required to enter their password. Settings for features available to users using the sudo command are stored in /etc/sudoers (more details in man/etc/sudoers).

    File handling and access - basic terminal commands
    Linux Terminal Commands Most Used:
    • pwd – output of the current working folder;
    • ls – output a list of files and folders;
    • cd–select a working folder;
    • locate – search for files;
    • chmod – setting access rights;
    • rpm–qa– shows installed packages in rpm-linux;
    • dpkg -l |more – shows installed packages in deb-linux;
    • rpm–i(rpm -e) – installation (removal) of the rpm package;
    • apt-get install (apt-get remove) – installation (removal) of a deb package;
    • mount (umount) – mounting (unmounting) storage media;
    • fdisk –l – view a list of all connected media;
    • mkfs – formatting disks and partitions.
    Linux terminal commands for network configuration and process management
    Knowing the following basic commands will give you an initial understanding of setting up a network in Linux, managing processes, and more using terminal commands:
    • ifconfig – display settings network interfaces, setting up network parameters (IP, mask, etc.), starting the network;
    • ping – checking the availability of network nodes;
    • route – view and configure the routing table;
    • nameserver – setting up DNS servers;
    • psaxjf – show running processes;
    • pgrep -l– show process ID;
    • kill – Linux terminal command to end a process;
    • clear – clears the terminal window;
    • export – default printer destination;
    • lpr – print output.
    Terminal commands can be combined into containers, written to files and, if necessary, launched for execution.

    Maybe sequential execution of basic Linux commands or performance subject to certain conditions. Command processor along with knowledge of terminal commands is an important tool of this OS.

    Basic Linux commands give you an idea of ​​how to use the terminal. Behind detailed information you can always contact help system, which is included in every distribution.

    All Linux newbies You've probably already heard about the terminal, or as it is also called the command line. After all, the presence and complexity of the terminal is one of the main arguments of Linux opponents. You may have already encountered the command line in Windows in practice and already know what it is.

    Indeed, the Linux operating system has a terminal where you can execute the commands you need to manage your system very efficiently. But this is not at all necessary; for many, a graphical interface is quite enough. Now the use of the terminal has faded into the background, but it remains the main means of accessing remote servers and a tool for professionals.

    The Linux terminal is much more interesting than the command line Windows string and in this article, working in the Linux terminal for beginners will be discussed in detail, as well as what a Linux terminal is and, in fact, what it is.

    The use of the terminal began a very long time ago. Even before DOS was created, there was no graphical interface. Back in the eighties, the operating room Unix system was just beginning to develop. Users need to interact with the system in some way and the easiest way is to use commands. You enter a command, the system returns a response to you.

    Since then, this input method was used in many systems, including DOS and Apple's OS/2, until the graphical interface was invented. Terminal text mode was then successfully superseded, but it is still used where it is needed.

    Above, by terminal we understood the place where you can enter commands and receive a response from the computer. This can be in Linux text mode or open in graphic mode terminal window. In Linux, the following words are often used: console, terminal, command line, command shell, tty, terminal emulator. They all relate to the terminal, but mean slightly different things. Before moving on, let's understand the terms so that we can call everything by its proper name.

    Under terminal It is common to understand the environment where you can enter commands and receive a response to them, this can be a physical terminal or a terminal on a computer.

    Console- This physical equipment to manage the server. When the server is not accessible from the network, you can only use the console to manage it.

    TTY is a device file that is created by the kernel and provides terminal access to programs. These files may be /dev/tty for permanent text terminals and /dev/pts/* for terminal emulators. You can execute a command or send a message by simply writing data to this file, and also get the result by reading data from this file.

    Terminal emulator- This graphics program, which gives you access to a tty or pts terminal. For example, Gnome Terminal, Konsole, Terminix, Xterm and many others.

    Command shell- the tty device only deals with transmitting and receiving data, but someone else must process all this data, execute commands, and interpret their syntax. There are a lot of command shells, these are bash, sh, zsh, ksh and others, but Bash is most often used.

    Well command line- this is the place where you will enter your commands, the terminal prompt for input.

    Now that we have figured out what a Linux terminal is and know all the basic principles, let’s move on to the practice of working with it.

    How to open a Linux terminal?

    There are several ways to access the terminal. Your default provisioning system creates 12 virtual terminals. In one of them - usually the seventh - your graphical shell, but all others can be freely used. To switch between terminals, you can use the combinations Ctrl+Alt+F1-F12. To authorize, you will need to enter your username and password.

    These are text terminals without a graphical interface; they may not be very convenient to work with, but such terminals will be useful if the graphical interface does not work.

    The second method allows you to open a virtual terminal directly in graphical interface using a terminal emulator. The Linux terminal emulator works with files in the /dev/pts/* directory and is also called a pseudo-terminal because it does not use a tty.

    In Ubuntu, you can launch the Linux terminal by pressing a keyboard shortcut Ctrl+Alt+T:

    It can also be found in the Dash application menu:

    As you can see, opening the command line in Linux is very simple.

    Executing commands in the terminal

    Let's take a closer look at the Linux terminal for beginners. As I already said, the terminal and tty device files are only responsible for transferring data. The command shell is responsible for processing commands, to which the data received from the user is transferred.

    You can type something and see if it works:

    To execute a command, just write it and press Enter.

    Moreover, team Bash shell supports auto-completion, so you can write half a command, press TAB, and if only one command begins with such characters, then it will be automatically completed, but if not, then you can press TAB twice to see possible options.

    The exact same scheme works for file paths and command parameters:

    In Windows you couldn't even dream of this. To execute a command, you can specify the name of its executable file or , relative to the root or any other folder. It is important to note that the command Linux shell, unlike Windows, is case sensitive, so be careful when entering commands and their parameters.

    By default, linux command line work can be done using large quantity commands, many of them, for example, for moving through directories, viewing content, installing software, are supplied with the system.

    An instance of a running command is called a process. When one command is executed in the Linux terminal, we need to wait for it to complete before executing the next one.

    Commands can be executed without parameters, as we saw above, or with parameters that allow you to specify the data with which the program will work, and there are also options with which you can customize the behavior. Majority standard utilities adhere to this syntax:

    $ command options parameter1 parameter2...

    Options are often optional and clarify one or another aspect of the program's operation. They are written in the form of a dash and a symbol or a double dash and a word. For example -o or --output. Let's give an example for the ls command. Without options and parameters:

    With a parameter indicating which folder to look at:

    With the -l option, output as a list:

    In with option and parameter:

    You can combine two options:

    Basically, this is all you need to know about commands in order to use them productively. We could also talk about combining commands and redirecting the output of one command to another, but this is a separate topic.

    conclusions

    This article discussed working in the Linux terminal for beginners. Team Linux string may seem very complicated at first, but it is not at all, it is much easier to use than in Windows and allows you to manage the system more efficiently. I hope this article sheds some light on this very big topic.

    about the author

    Founder and administrator of the site, I am passionate about open software and operating room Linux system. I currently use Ubuntu as my main OS. In addition to Linux, I am interested in everything related to information technology and modern science.