Basic commands in the Linux console

The Linux operating system is very popular with programmers and those who like to tinker, because it provides for the active use of a console containing hundreds of commands. If you decide to seriously take up learning this flexible OS, you should first learn in basic commands.

Why do they exist in Linuxconsole commands? By entering them into the console, the user can quickly perform a lot of actions: opening, moving and copying files, viewing various information and statistics, monitoring and debugging, obtaining detailed information about the system, modification of the software and visual part of the system. And these are just some of the features you get with these commands.

Many have Extra options, and some don’t work at all without them. To begin with, try simply entering commands into the console and studying their effect.

The ability to modify the system with commands makes Linux a very versatile operating system. You can customize it for yourself by changing anything in it. At first, the commands may seem complicated, but once you learn them well, you will significantly speed up your work with the computer and begin to truly enjoy it, realizing that everything in it is customized by you to suit your needs.

Remember that for full-fledged work with the console you need administrator rights. Below is a list main commands V Linux consoles and their decoding.

1. Simple steps

ls— display a list of files in the current directory.

CD[directory] - change the current directory. If a directory name is not specified, the user's home directory becomes the current directory.

cp<что_копировать> <куда_копировать>- copy files.

mv<что_перемещать> <куда_перемещать>— move or rename the file.

rm<файлы>— delete files.

mkdir<каталог>— create a new directory.

rmdir<каталог>— delete an empty directory.

rm -r<файлы и/или каталоги>(recursive delete) - delete files or directories and their subdirectories. BE CAREFUL with this command because Linux doesn't have a system yet full recovery deleted files(unless you use special programs to place deleted files in a special directory, something like the “recycle bin” in Windows).

cat<имя_файла>- output the contents of the file to standard output(default - to screen).
You can record text you type on the screen using the following sequence of steps:

cat ><имя_файла>
.
.
.
CTRL/d

more<имя_файла>— viewing the contents of a long text file page by page.

less<имя_файла>— viewing the contents of a text file with the ability to return to previous pages. Press q when you want to exit the program. "less" - analog DOS commands“more”, although very often “less” is more convenient than “more”.

pico<имя_файла>- edit text file using the pico text editor.

tar -zxvf<файл>— unpack the archive tgz or tar.gz

find<каталог>- name filename - find a file with the name “filename” and display the search result on the screen. The search starts with the directory<каталог>; "filename" may contain a search mask.

pine is a good text-oriented email reader.

mc- launch the file management program " Midnight Commander"(Looks like Norton Commander, but its capabilities are closer to far).

./ Program_Name - run an executable file in the current directory if the current directory is not in the list of directories specified in the PATH environment variable.

xterm(in X terminal) - launch a simple terminal in a graphical X-windows shell. To exit it, type "exit".

2. Standard commands and commands that provide information on the command system (always typed on one line)

pwd— display the name of the current directory.

whoami— display the name under which you are registered.

date— display date and time.

time<имя программы>— execute the program and obtain information about the time required for its execution. Don't confuse this command with date. For example: I can run the ls command and find out how long it takes to list the files in a directory by typing: time ls

who— determine which user is working on the machine.

rwho-a— identification of all users connected to your network. This command requires that the rwho process be running.

rupture— which machines are running on the network and which are stopped.

finger<имя_пользователя>— system information about the registered user. Try: finger<ваш login-name>

uptime— the amount of time that has passed since the last reboot of the operating system.

ps a— display a list of current processes in your session.

top- interactive list of current processes, sorted by CPU usage.

uname -a— display information about the operating system version.

free— display information on memory usage.

df -h— display information about free and used disk space.

du. -bh | more— display information about the size of files and directories, starting from the current directory.

set|more— display the current values ​​of environment variables. (Not for all shells. For csh/tcsh - printenv | more, although set will also show useful information.)

echo $PATH— display the value of the environment variable “PATH” The echo command can be used to display the values ​​of any environment variables. Use the set or printenv commands to get a complete list.

3. Networking

ssh- ensures safe entry into remote session work with another machine, and also allows you to perform given command on a remote machine without logging into a work session:

ssh[-l Your_user_name_on_the_remote_machine]<имя_удаленной_машины>— entering a session on a remote machine. Use the machine name or its IP address. (You must be logged in to this remote machine). If your username is the same on the local and remote machines, then you don’t have to type it, i.e.: ssh<имя_удаленной_машины>- will allow you to log into a session on a remote machine

ssh<Ваше_имя_пользователя_на удаленной машине@><имя_удаленной_машины> <команда>— will execute the specified command on the remote computer and send you the result of its execution on the screen (When establishing a connection via ssh, you will have to enter the password that you have on the remote computer; in this case, the password will be transmitted over the network in encrypted form, i.e. secure way.)

scp— provides secure copying of files on the network:

scp<имя_файла_на_локальном_компьютере> <Ваше_имя_пользователя_на удаленной машине>@<имя_удаленной_машины>: - copies the file from local computer to your root directory on the remote computer (the presence of “:” at the end of the command is required).

telnet<имя_удаленной_машины>— contact another machine via telnet. Log in to your session once the connection is established using your password.

ftp<имя_удаленной_машины>— contact a remote computer via ftp. This type of connection is good for copying files from/to a remote machine.

It is preferable not to use telnet commands and ftp, and use only ssh and scp, as they ensure the security of the network connection!

hostname -i— shows the IP address of the computer you are working on.

4. Some administration commands

alias ls="ls -Fskb --color"— create an alias alias so that one command can launch more than one complex combination commands Place the alias creation in the /etc/bashrc file if you want these aliases to be available to all users on your system.

For tcsh, the format for defining alias is different:

alias la ‘ls -AF —color=none’

kapasswd— command to change the password for accessing the AFS file system. When working on a basic LIT Linux cluster, you should use only this command (and not the passwd command!) to change the password for joining the cluster.

passwd— change your password on any local computer.

chmod<права доступа> <файл>— change access rights to a file that you are the owner of.
There are three ways to access the file:
reading - read (r), writing - write (w), execution - execute (x) and three types of users:
the owner of the file is owner (u), members of the same group as the owner of the file (g) and everyone else (o).
You can check your current access rights in the following way:

ls -l file name

If the file is accessible by all means to all users, then next to the file name there will be the following combination of letters: rwxrwxrwx
The first three letters are the access rights for the file owner, the second triplet are the access rights for his group, the next three are the access rights for the rest. Lack of access rights is shown as “-”.; For example: This command will allow you to set read permissions for the file "junk" to everyone (all=user+group+others):

chmod a+r junk

This command will remove the permission to execute the file from everyone except the user and group:

chmod o-x junk

For more information, type chmod --help or man chmod, or read any Linux manual. You can set default permissions for files you create using the "umask" command (type man umask).

chown<новый_владелец> <файлы>— change the owner of files.

chgrp<новая_группа> <файлы>— change the group for the file.

You can use the last two commands after you have made a copy of the file for someone else.

5. Process control

p.s. | grep<Ваше_имя_пользователя>- display all processes running on the system under your user name.

kill- “kill” the process. First, determine the PID of your “killed” process using ps.

killall<имя_программы>- “kill” all processes by program name.

xkill(in the X window terminal) - “kill” the process whose window you point to with the cursor.

6. Linux built-in software utilities and languages

emacs(in X terminal) - emacs editor. Very multifunctional, but very complicated for inexperienced users.

gcc - GNU C compiler. There are very good tutorials online for how to use it.

g++ — GNU C++ compiler.

In Linux, any administrative task can be performed from the console. The ability to work from the console is a necessary experience for administering Linux. There are tools that allow you to avoid talking to the console, but with them you will be more limited in what you can do. Connecting to the console is easy and getting documentation for the commands is also easy. This article describes the simplest and most necessary commands to get started in the console.

Console connection

If your system boots into text mode(a common configuration for servers to receive console output from main processes), then you are already in the console when you log in. Typically on a Linux system you can access additional consoles by pressing Ctrl + Alt + (F1 – F6). Each console is a completely separate session in the system and can be used by different users at the same time.


This "multi-console" behavior is different from the "multi-desktop" behavior in Windows. In Linux, each console can be controlled by completely different users. For example, you can log in as root on the first console, and as joeuser on the second. Both consoles run different programs in the space of its user. In the same spirit different users can log in remotely Windows system. In this case, Linux provides a mainframe-like experience rather than a simple server or workstation.

If you are working in graphical mode, you can open a terminal to access the console window. There is usually a Terminal button on the desktop taskbar, or it can be found in the Program menu in System Tools. The terminal can also be opened from context menu(appears when you right-click on the desktop).

Teams

A lot is available from the console additional commands. Some of them are only really useful when writing scripts. Here are some of the ones you'll probably need. Don't forget that all commands and switches are case sensitive. -R is not the same as -r and will most likely produce a different result. Console commands are almost always written in lowercase.

CD
To navigate through directories, use the familiar cd command. The main thing to remember is that where you are used to backslashes (\), Linux uses forward slashes (/). Backslash also occurs, but for a different reason - it indicates that the command will continue for next line. This is sometimes done for better readability when typing very long commands.
ls
A list of files in a directory is called with the ls command. There are several keys that can be used to change the appearance of the list:

ls -l Shows extended output including file sizes, last modified date and time, and attributes
ls -t Sorts files by time
ls -S Sorts files by size
ls -r When used in conjunction with one of the sort keys, changes the order of the output. ls -lt shows the newest files at the very top of the list. ls -lrt shows the newest files at the very bottom.
ls -h Readable. Uses friendly indicators k, M and G, which show the file size in human readable units, rather than displaying it in bytes.
ls -a Shows all files in a directory, even hidden ones

cp
Files are copied using the cp command. Main keys:

mv
The mv command is used to move and rename files.

cat
You can view files using the cat command. This command will output the contents of a file to another file, either to the screen or to the input of another command. cat is short for "concatenate", so you can use it to combine multiple files into one larger file.

more
The more command allows you to view information page by page.

less
To view a text file with the ability to scroll up and down and search by pattern, use the less command.

vi
The vi test editor is available in almost any UNIX-like environment. The version installed on Linux has a built-in tutorial, and once you get the hang of it, you can do some truly incredible things with just a few button presses. Vi is very convenient for editing files with passwords and configurations.

man
Documentation for a particular command can be seen using the man command. Man is short for manual(). The documentation is usually complete. You can learn more about the man command by typing:

info
info is similar to man except that it supports hyperlinks, which makes navigating the documentation easier.

What shell?

Shell command line is a layer separate from the operating system. The shell environment affects features such as editable command lines and scrollable histories. The shell also defines the syntax required to create functions in scripts. IN Linux scripts can contain loops and do more than just conditional statements, including many of the things you'd expect from a programming language.

The default shell is a different option for each user. Typically on Linux this is /bin/bash, but it could be something else. The man documentation for each shell is really very good, covering shells and how they work in detail. Select a shell from the list below and have a look at it background information(man page).

bash
The bash shell is a free version of the Bourne shell, the first Unix shell, plus many additional properties. Bash has editable command lines, a scrollable command history, and tab appending so you don't have to type long file names.

csh
The C shell uses a C-like syntax and borrows many features from the Bourne shell, but uses a different set of internal shell commands.

ksh
The Korn shell uses the same syntax as the Bourne shell and incorporates the user friendliness of the C shell. ksh is used in many installation scripts, so it should probably be on the system even if it is not the main shell.

tcsh
TC shell is an improved version of the C shell and is 100% compatible with it.

zsh
Z shell is an improved version of the Korn shell with many of the features of the bash shell.

One attractive file opportunity Linux systems-- links to files. Thanks to them, a file can be visible in several places in the file system. However, on Linux, the link can be treated as a source file. The link can be executed, edited, accessed without doing anything unusual. Some applications in the system are a link to some executable file. When you make changes to a file via a link, you are actually editing the original. A link is not a copy. There are two types of links: hard and symbolic.

Hard link can only point to files on the same file system. It provides a link to the file's physical index (aka inode) in the file system. Hard links are not broken when the original is moved because they all point to the physical data of the file rather than its location in the file structure. A file with a hard link does not require the user to have access rights to source file and does not show its location, which provides some security advantages. If you delete a file that has hard links, it will still remain until all links to it are deleted.

Symbolic link-- pointer to the file location in the file system. Symbolic links can span file systems and even point to files from a remote file system. A symbolic link points to the location of a source file, and to use it, the user must have permissions to that source file. If the original is deleted, then all symbolic links are broken. They will point to a non-existent file.

Both types of links can be created using the ln command.

Exit shell

In many cases, using the console requires less time and provides more options than graphics program. Moreover, any console task can be written into a script and thereby automated.

Leave your comment!

The need to work in a text console is the very cliff on which the good intentions of users who want to quickly master Linux are most often dashed. And, as a rule, even before they even try to install the system. The myth that the command line is unfriendly is so firmly rooted in the public consciousness that it is not easy to destroy it.

However, this is really nothing more than a myth that can be invented about anything. At least about the usual computer keyboard. Anyone who sees it for the first time in their life will be quite surprised that the buttons are not arranged alphabetically. And this decision will probably seem very strange to him, since at first he has to search for each letter for quite a long time.

However, it never occurs to anyone to place the keys in any other way. Because the convenience of this seemingly unfriendly interface has long been proven and is beyond doubt. And if you master typing blindly, the time spent on learning will pay off many times over.

As with the keyboard, aversion to the command line is most often not technical, but psychological. Working in the console is not a forced measure caused by the lack of “normal” tools, and not the bravado of “advanced” users, but the fastest and user-friendly interface to solve a number of problems.

What are its advantages? First of all - in versatility. No matter what distribution you are using, basic commands will be the same. We must not forget that text mode is more stable than graphic mode. Just remember the famous BSoD (“ blue screen death") in Windows. For some reason, the inscription is displayed in the console, and not in a beautifully drawn window.

Because graphic Linux interface- this is essentially ordinary application program, then its inoperability does not lead to a general collapse of the system. If the user is not afraid of text mode, he will quickly enter necessary changes to the appropriate configuration file and will restart the system. Otherwise, you will have to resort to completely reinstalling it, which will take much longer.

Finally, console commands are handy for doing some things. routine operations. After all, the computer was invented to automate the work process. Of course, in order for the console to work effectively, the user will have to spend a little time studying standard commands Linux. But it is compensated quite quickly.

There are two ways to switch to command line mode. The first is to activate the text console. To do this, press the key combination Ctrl+Alt+F[console number]. An invitation to register in the system will appear, where you need to sequentially enter your login and password. The second way is to open the console directly in the window manager. In this case, the user continues to work in graphical mode. It is important to understand that in both the first and second cases everything running programs will continue to function normally.



If everything is clear with launching the terminal in graphical mode, then activating additional consoles may raise a number of questions. What specific function key should I press? How many consoles can function simultaneously and is it possible to change their number? How to go back to the GUI

Typically, there are six text consoles available by default. Since maintaining each requires approximately 4 MB of memory, it is advisable to reduce their number on weak machines. To do this, open the /etc/inittab file with system administrator rights, find a section consisting of entries like “2:2345:respawn:/sbin/mingetty tty2”, each of which corresponds to one console, and put a comment sign (#) opposite extra. The number of lines in this section is equal to the number of text consoles. Moreover, in most distributions, one of them is used not for user registration, but for system messages. Isn’t it very convenient in case of any problems: the medical history is always available.

The number of virtual consoles is set in the /etc/inittab file

The first digit in the line is the console number and, accordingly, the number function key, which must be used in combination to call it. To switch text consoles, you need to press not Ctrl+Alt+F[console number], but simply Alt+F[console number] - Ctrl key Applies only in graphical mode.

To return to the graphical interface, you must activate the corresponding console. Her number is on one Furthermore, which was the last one registered in /etc/inittab. For example, if six text consoles are used, then the window manager is launched on the seventh.

When working in text mode, the visual marker for the start of a line can be of two types: a sharp sign (#) and a dollar sign ($). The first indicates that the user is running as root and all system files are open to him. In this case, it is necessary to exercise special caution - rash actions are fraught with serious consequences.

A regular user is represented by a dollar sign. There is also a small nuance here. The concept of restricting access rights means that some commands that require extended privileges will refuse to run. Moreover, the specifics of UNIX are such that no hints or explanations will appear on the screen - it is assumed that a person is in complete control of the system and does not at all need the help of programs, from which only the unquestioning execution of the owner’s orders is required.

On the other hand, the seeker Additional information will always find her. One of the most important and frequently used commands is man [name]. It will display reference guide, dedicated to any system object, the name of which is specified as an argument. Of course, information is not taken out of thin air, but from a file, for which it must be physically present on the disk. Please note that some developers try to reduce the size of the distribution by not including help pages. In this case, they must be installed separately.


The man command will display a reference manual for any system object.

Since man is a system object just like everyone else, you can get help on it by typing man man. Apparently, the user who downloaded Linux for the first time should start with it.

Each guide is made up of sections called fields. The NAME field is for brief information about the object. The SYNOPSIS field contains information about how to run the program. Finally, the DESCRIPTION field is a detailed description.

But what should the user do if he does not yet know which program can complete his task? Use the apropos or whatis commands. They are intended for searching information in manuals. The difference between them is that the first searches the entire database, while the second searches only by the names of objects contained in the NAME field. Obviously, one is slower but provides more information than the other.

Most often, operations to configure the system are performed in text mode. Does this mean for the user that he will have to activate new console combination Ctrl+Alt+F[console number]? Not at all: in most cases graphic mode no need to leave.

In order to run any program with administrator rights, you need to open a terminal and type the su command without parameters, then the system will ask you to enter a password user root-- and you are provided with full access to the files.

Now let's look at a few examples that indicate that the command line was not invented to mock the user, but, on the contrary, for his convenience. Let's perform a number of fairly popular operations without the help of “menus and buttons”.

Let's say you need to split a file into several parts to send it by email (the original size is so large that the server won't let it through). To do this you need to use the split command. It copies the file, breaking it into separate fragments of a given size (default - 1 MB). Two names should be used as arguments: original object and a prefix of what is produced in the output.

For example, there is a large video called name.avi. We need to split it into 10 MB pieces. The command will look like this: split -b1000k name.avi name. The first argument specifies the volume of the resulting object, the second is the name of the source, and the third is the prefix of the result name. Thus, as a result of the operation, the files name.aa, name.ab, name.ac, etc. will be obtained. The command cat name.* > name.avi will help to put the pieces together.


Using the cat command you can quickly view the contents of a file

Often the user needs to compare two files. The easiest way is to use the command cmp [first file name] [second file name]. If the objects completely match, then the program will silently exit, because there is nothing to tell it. If it detects any difference, it will give the user the number of the corresponding line.

If a complete list of inconsistencies is required, then you should use the diff command [name of the first file] [name of the second file]. In this case, the program will display a complete report.

In some cases, it is convenient that information about differences does not appear on the screen, but is immediately saved in a file. To do this, you can use the output redirection function, and the command will look like this: diff [first file name] [second file name] > [report file name].

The output redirection operation allows you to use commands that seem quite simple at first glance to significantly speed up your current work - for example, compiling a complete list of all files in a directory.

The ls program is responsible for viewing the contents of the directory. In order for the result of its work to be saved in a file, you need to use the feature already known to us and type ls [directory name] > [name of the file where the information will be written] in the console.


The contents of the directory can be viewed by typing the ls command in the console

Finally, one last note. Users often complain that working on the command line is associated with increased memory load. Like, you have to keep all the names of utility utilities in your head. This is not entirely true - in most cases it is enough to know only the first few characters. On click Tab keys the shell itself will try to add the full name (or offer options, if any). ka

Linux console applications

As has already been said many times, a graphical interface is not required to work in Linux. By the way, some distributions to this day are not equipped with the XWindow system. And, it should be noted, this does not make them less popular.

Of course, it is naive to think that a significant portion of users will prefer console applications graphic. And even more so, one should not even assume that someone, having become familiar with such programs, will radically reconsider their views on ergonomics. In practice, the console mode is in demand only when the use of conventional “windows” is either impossible or clearly impractical.

For example, the system is installed on a server. In order to edit a configuration file once a month (or even less often), it is hardly reasonable to waste system resources on supporting absolutely unnecessary things. in this case GUI.

There are a great many console applications, but we will briefly look at only the four most popular and often used in practice. This is text vim editor, browser links, file manager Midnight Commander and lftp FTP client.

Linux console commands, or as they also say the command line, are a kind of intermediate link between the user and the computer itself. In order for the machine to carry out your order, it must be given the appropriate command. Initially, this is exactly how the relationship between a person and a computer took place, but a little later, it appeared additional tool a mouse that greatly simplified the entire process of information exchange and made it more accessible to all users. However, the console today remains powerful and sometimes very convenient tool to perform all kinds of actions.

At all, console utilities There are a great many, but here we will briefly, as an example, consider only two of them, but they are very important and often used. Utility Apt-get, designed to work with software packages. For those who do not recognize the console at all, they can use the wonderful graphical shell for Apt-get, entitled Synaptic(available in the official repository).

How to use the utility?

//basic formula

sudo apt-get command

//as an example, update all packages

sudo apt-get upgrade

Basic apt-get commands when working with packages.

apt-get update //update info. about packages from repositories
apt-get upgrade //update all packages
apt-get dist-upgrade //updating the system as a whole
apt-get clean //cleans the lock. storage other than cache files
apt-get autoclean //same as clean, with deleted cache files
apt-get check //updates cache and check. unsatisfactory dependencies
apt-get autoremove //removing previously downloaded but unnecessary packages
apt-get remove //removing the package from the save. config. files
apt-get purge //removing the package with all dependencies
apt-get install //install the package
apt-get build-dep //install everything to build source packages
apt-get source //downloads source packages

Options:

-h, --help //reference
-q, --quiet //hide the progress indicator
-qq //do not show anything except errors
-d, --download-only //just receive packets and exit
-s, --simulate //perform event simulation
-y, --yes //automatic answer "Yes" to all questions
--reinstall //reinstall packages
-f, --fix-broken //fix broken dependencies
-m, --ignore-missing //ignore missing packages
-u, --show-upgraded //show updated packages
--no-upgrade //do not update packages
-b, --compile, --build //assemble the package after receiving
-D //when deleting, remove dependent components
-V //show package version numbers in detail
--no-remove //if the packages are marked to deleted., then apt-get off
--force-yes //force execution of the specified operation

Funny.

apt-get moo

You should see a cow asking, “Did you moo today?”

"aptitude" utility.

Let's consider another very good utility entitled " aptitude", in fact, this is the same as " apt-get", but is considered better, and also has a pseudo-graphical interface. The principle of operation is exactly the same, only instead of " apt-get", you need to enter a value " aptitude". First, let's install the utility itself:

sudo apt-get aptitude

Now if you type: aptitude, you will be taken to the program interface.

Let's look at some commands:

// Install the package.

sudo aptitude package1 package2 package3

As you can see, you can install an unlimited number of packages at once. No matter how many times you install them, aptitude will automatically resolve all dependencies, all you have to do is agree (y) and press (enter). Also, by analogy, you can remove packages:

sudo aptitude remove package_name1
or
sudo aptitude purge package_name1

The first command deletes only the package files without touching the settings, the second deletes everything completely. You can view the package description like this:

aptitude show package_name

In general, this utility is an absolute analogue of " apt-get", but when installing and removing packages, it is advisable to use it rather than " apt-get". At least on the official website Ubuntu give exactly the same recommendations.

Other console commands.

List of commands related to information.

hostname //machine network name
whoami //current user name
uname -m //shows the machine architecture
uname -r //kernel version
sudo dmidecode -q //inform. about the device. ensuring the system
cat /proc/cpuinfo //information about the processor
cat /proc/interrupts //interrupts
cat /proc/meminfo //all memory information
cat /proc/swaps //all information about swap
cat /proc/version //kernel version and other information
cat /proc/net/dev //network interfaces and statistics
cat /proc/mounts //mounted devices
cat /proc/partitions //available sections
cat /proc/modules //loaded kernel modules
lspci-tv //PCI devices
lsusb -tv //USB devices
date //The current date
cal //calendar and current month
Cal 2012 //shows the entire year 201

Commands related to reboot and shutdown processes.

shutdown -h now //turn off the system
init 0 //turn off the system
telinit 0 //turn off the system
shutdown -h hours:minutes & //schedule system shutdown
shutdown -c //cancel scheduled shutdown
shutdown -r now //reboot the system
reboot //reboot the system
logout //end session

File operations and more...

cd /home //go to home directory
cd.. //go to higher level
cd ../.. //go up 2 levels
cd- //go to previous directory
pwd //show the path to the current directory
ls
ls -F //show files and directories
ls -l //show. details about files, directories
ls -a //show hidden files
mkdir dir1 //create a directory named dir1
mkdir dir1 dir2 //create directories dir1 And dir2
mkdir -p /tmp/dir1/dir2 //create a directory in the specified location
rm -f file1 //delete file with name file1
rmdir dir1 //delete directory with name dir1
rm -rf dir1 //delete directory dir1 and all its contents
rm -rf dir1 dir2 //delete directories dir1\dir2 and contents
mv dir1 new_dir //rename / move directory
cp //copy files/folders
ln -s //create a symbolic link
chmod //assigning rights to files

Search files and directories.

Forgot where you saved it? No problem! You can find everything in the console.

find / -name file1 //search for files, director. beginning With /
find / -user user1 //search for files, direct. Withuser1
find /home/user1 -name \*.bin //search for files .bin V / home/ user1
find /usr/bin -type f -atime +100 //claim bin. files, sudden 100 days
find /usr/bin -type f -mtime -10 //claim files created/edited in 10 days
find / -name \*.deb -exec chmod 755 "()" \; //claim files ( .deb) and change. rights
locate\*.ps //find files with extension.ps
whereis halt //show the path to the programhalt
which halt //show. full path to programhalt

At first glance, all this may look somewhat intimidating, but this is only at first glance. Don’t immediately rush into panic and immediately return to Windows(y). Modern distributions, as well Ubuntu in particular, it completely allows you to do without the command line. However, the command line, in some cases, is much more convenient than the graphical interface. Also, it is not at all necessary to memorize all these commands; it will be enough to create a text file, copy all the contents into it and keep it nearby, like a cheat sheet that you can use if necessary.

Of course, this is not all that concerns the topic of the command line and the commands themselves; if anyone is really interested in this, I can advise you to go to following link, you can find and download a lot of things there, the only question is whether you need it all. I generally doubt that today there is at least one person in the whole world who would know by heart all the existing console commands (maybe I’m wrong).

Linux command references: http://books.tr200.ru/v.php?id=278389

IN modern versions In the Linux operating system, all actions can be done through the graphical interface, and it is not at all necessary to use the terminal. But older computers or servers may not have enough resources to run complex GUIs and applications. Then Linux terminal programs come to the rescue.

For Linux there is great amount console programs and all of them can almost completely replace the graphical interface. If you can watch the video comfortably and still can’t, then find necessary information on the Internet, listen to music, read emails you can even use the terminal. In this article, we will look at the best Linux console programs that you can use on your computer.

It is not always enough to have one running terminal, which is available to us when connecting via ssh or in one of the TTY interfaces. Sometimes you need to manage several sessions at the same time, but there is no way to run a graphical interface and several terminal emulators.

In such cases, the screen utility comes to the rescue. It makes it very easy to manage multiple terminals in one TTY. You can open new terminal windows, switch between them, copy information, and much more. Even if the session is unexpectedly terminated due to the ssh connection being lost, the programs will not be terminated and will continue to run and you will be able to re-establish the connection.

2. MidnightCommander - file manager

MidnightCommander or mc is a two-panel file manager for operating systems Linux. It is very similar to file FAR manager, famous Windows users. All working space is divided into four parts - these are two panels, a command line and a line indicating the assignment of function keys:

For all terminal commands current folder counts active panel and you can do any Linux commands. For easy navigation there are a lot of keyboard shortcuts here that are very similar to Emacs. To install on Ubuntu, type the command:

sudo apt install mc

3. Lynx - browser

Lynx is a full-featured console browser. With it you can browse the Internet. This is one of the very first browsers. It looks very simple, does not support tables, css, javascript and other technologies. But the pages load very quickly.

Navigation is performed using hotkeys, which allows you to use the program very efficiently. HTTP, FTP, Gopher, WAIS, NNTP protocols are supported.

4. Elinks - another browser

Elinks - more new browser, it is based on Lynx but supports more features, there is initial support for styles, support for JavaScript, tables, frames. There's even support color palette up to 256 colors.

In addition, more protocols are supported: HTTP, HTTPS, FTP, IRC, mailto, telnet, nntp and Gopher. Working with links and hotkeys are slightly different from lynx, but using the browser is quite convenient. To install elinks on Ubuntu, run the command:

sudo apt install elinks

5. Vim - text editor

Vim is one of the best text editors for the Linux operating system, not only among console utilities, but in general. The program has a very unique interface and operating modes that allow you to type text and execute it most quickly and efficiently, without taking your hands off the keyboard:

You can navigate through the text using keys h,j,k,l in command mode, and also perform quick replacements using r. To switch command mode and editing mode, use the Esc key. See more details in a separate article.

6. Moc - audio player

Moc or Music on Console is an audio player for Linux terminal, Very simple program, which only allows you to listen to music. The interface is very simple and similar to that of Midnight Commander.

You just need to select a file from the desired folder through the main menu, and then the program will start playing all the files in order. The player can work in background even after closing the terminal session.

7. RTorrent - torrent client

As the name suggests, rtorrent is a simple torrent client that, like other command line applications, only works through the terminal. The program is undemanding in terms of resources and has a not very user-friendly interface, but it works quite quickly and stably.

It is also very supported flexible setup programs via the rtorrent.rc file. But the file syntax is quite complex.

8. Newsbeuter - RSS reader

It is very simple but fully functional RSS reader for Linux, the program completely copes with its task, despite the fact that it only has a terminal version. You can add several feed URLs to the program configuration file, then synchronize local database data with information on the server.

The program can remember entries already read. To install on Ubuntu use this command:

sudo apt install newsbeuter

9. Mutt - email client

Mutt is an email client for the Linux operating system. It supports many formats for creating messages, including MBox and Maildr, as well as protocols, for example: IMAP, POP3, you can view mail from various services, for example, mail.ru, gmail.com, yandex.ru and many others using available protocols.

The program has a very simple, but at the same time user-friendly interface, and also supports encryption and electronic signatures.

10. WeeChat - messenger

WeeChat is an excellent IRC client for operating systems based on Linux kernels. In addition to the console interface, there is a graphical and web interface. The program supports work through proxies, ipv6, ssl, text and message search, as well as spell checking.

Using convenient keyboard shortcuts, you can perform any action very quickly. Also supported various extensions in Python, Ruby and Perl, allowing you to greatly expand the capabilities of the program. To install on Ubuntu do:

sudo apt install wee-chat

11. Calcurse - calendar

Linux console applications also cannot do without time planning tools and calendars. Calcurse is a very simple yet functional calendar and to-do list for Linux.

With this program, you can keep track of your things that need to be done, as well as certain events and appointments. There is also a reminder system with which you can receive notifications about task deadlines and events.

12. Taskwarrior - to-do list

Taskwarrior is a very simple task list for Linux. You can create tasks, very quickly view the list of available ones, mark those already completed, and also schedule a completion date.

In conjunction with the Timewarrior utility from the same developer, you can track the time it takes to complete each task. To install taskwarrior on Ubuntu run:

sudo apt install taskwarrior

13. cacaview - image viewing

Cacaview is a very simple image viewer with a console interface. The picture is displayed using ASCII characters. It’s difficult to fully view the images, but you can roughly estimate what is shown in the picture itself:

To install, you need to install the caca-utils package:

sudo apt install caca-utils

14. htop - monitor

htop is a usage monitor system resources in real time with a command line interface. You can see how much random access memory busy, CPU usage percentage, and which processes are using the most system resources.

Using the program, you can change the priorities of processes, terminate them, perform searches, filter processes by certain parameters, sort, and also view the threads of each process.

15. BitlBee

This is an open messenger source code, which allows users to communicate in services such as IRC, chat networks, AIM, ICQ, NET Messenger, Yahoo!, XMPP, Google Talk, Twitter and Identica. Users of these services are displayed as channels, after which you can communicate with them as ordinary users IRC networks.

It is even possible to create conferences. The program is designed as a server and to connect to it you must use any IRC client. To install, type:

sudo apt install bitlbee

conclusions

In this article we looked at the best Linux console programs. They will help you at the right time to fully work with your computer without a graphical interface or even replace other programs. If you know of other great console apps that are missing from this article, please post in the comments!