Linux x64 terminal and console commands. Basic Linux console commands

In all operating systems, including Linux, the term "command" means either a command line utility or a specific feature built into the system's command shell. However, for the users themselves this difference does not matter much. After all, both Linux terminal commands are invoked in the same way. You enter a word into your terminal emulator and get the command output.

I have already written about Linux terminal commands, but then I touched only on a few of the most interesting, most useful commands, relying on the fact that the user is already quite familiar with the capabilities of the terminal. But we need to make one more article, aimed at beginners, those who are just taking their first steps in mastering Linux.

And here she is. Its goal is to collect the basic simple and complex Linux commands that every user should know in order to most effectively manage their system. To make it easier to remember the command options, I added in parentheses the words from which they originated - it’s much easier, I’ve tested it myself.

This does not mean that I will list all the commands - I will try to cover all the most useful things that can be useful in everyday life. To make it easier to read, we will divide this list into categories of commands by purpose. Most of the utilities discussed here do not require additional installation; they will be pre-installed in any Linux distribution, and if not, they are easy to find in the official repositories.

1.ls

A utility for viewing the contents of directories. By default shows the current directory. If you specify a path in the parameters, it will list the contents of the destination directory. Useful options -l ( L ist) and -a ( A ll). The first formats the output as a list with more detailed information, and the second includes showing hidden files.

2. cat

Prints the contents of the file passed as a parameter to standard output. If you transfer several files, the command will merge them. You can also redirect output to another file using the ">" symbol. If you only need to print a certain number of lines, use the -n option ( N umber).

3. cd

Allows you to move from the current directory to the specified one. If run without parameters, it returns to the home directory. A call with two dots returns one level up from the current directory. Calling with a dash (cd -) returns to the previous directory.

4.pwd

Prints the current directory to the screen. This may be useful if your Linux command line does not output such information. This command will be useful in Bash programming, where a script is executed to obtain a link to a directory.

5.mkdir

Creation of new directories. The most convenient option is -p ( P arents), allows you to create an entire subdirectory structure with one command, even if they do not exist yet.

6. file

Shows the file type. On Linux, files don't always have to have extensions in order to work with them. Therefore, it is sometimes difficult for the user to determine what kind of file is in front of him. This little utility solves the problem.

7.cp

Copying files and directories. It does not copy directories recursively by default (that is, all subdirectories and all files within subdirectories), so be sure to add the -r option ( R ecursive) or -a ( A rchive). The latter includes a mode for storing attributes, owner and timestamp in addition to recursive copying.

8.mv

Moving or renaming files and directories. It is noteworthy that in Linux this is the same operation. Renaming is moving a file to the same folder with a different name.

9.rm

Deletes files and folders. A very useful Linux command: with its help you can clean up all the mess. If you need recursive deletion, use the -r option. However, be careful: of course, in order to damage the system you will need to seriously try, but you can delete your own important files. Rm does not delete files to the recycle bin, from which everything can then be restored, but completely erases them. Operator actions rm irreversible. Believe me, your excuses like “rm ate my coursework” will not be interesting to anyone.

10.ln

Creates hard or symbolic links to files. Symbolic or soft links are something similar to shortcuts in Windows. They provide a convenient way to access a specific file. Symbolic links point to a file but do not have any metadata. Hard links, unlike symbolic links, point to the physical address of the disk area where the file data is stored.

11.chmod

Changes file permissions. These are read, write and execute. Each user can change the permissions for their files.

12. chown

Changes the owner of a file. Only the superuser can change owners. To change recursively, use the -R option.

13.find

Search the file system, files and folders. This is a very flexible and powerful Linux command, not only because of its sniffer abilities, but also because of its ability to execute arbitrary commands on the files it finds.

14. locate

Unlike find, the locate command searches the updatedb database for filename patterns. This database contains a snapshot of the file system, making searching very fast. But this search is unreliable because you can't be sure that nothing has changed since the last snapshot.

15.du

Shows the size of a file or directory. The most useful options: -h ( H uman), which converts file sizes to an easy-to-read format, -s ( S ummarize), which outputs minimal data, and -d ( D epth), which sets the depth of recursion across directories.

16.df

Disk space analyzer. By default, the output is quite detailed: all file systems are listed, their size, amount of used and free space. For convenience, there is an option -h, which makes the dimensions easy to read.

17.dd

As stated in the official manual, this is a terminal command for copying and converting files. Not a very clear description, but that's all dd does. You give it a source file, a destination, and a couple of additional options. It then makes a copy of one file to another. You can specify the exact size of the data to be written or copied. The utility works with all devices. For example, if you want to overwrite your hard drive with zeros from /dev/zero, you can do so. It is also often used to create LiveUSB or hybrid ISO images.

18 mount/umount

These are Linux console commands for mounting and unmounting Linux file systems. You can connect everything: from USB drives to ISO images. And only the superuser has the rights to do this.

Linux console commands for working with text

19. more / less

These are two simple terminal commands for viewing long texts that do not fit on one screen. Imagine a very long command output. Or you called cat to view a file and your terminal emulator took a few seconds to scroll through all the text. If your terminal doesn't support scrolling, you can do it with less. Less is newer than more and supports more options, so there's no reason to use more.

20. head/tail

Another pair, but here each team has its own area of ​​application. Head prints the first few lines of the file (head), and tail prints the last few lines (tail). By default, each utility outputs ten lines. But this can be changed using the -n option. Another useful option is -f, which is short for f ollow (follow). The utility constantly displays changes in the file on the screen. For example, if you want to monitor a log file instead of constantly opening and closing it, use the tail -nf command.

21. grep

Grep, like other Linux tools, does one thing, but it does it well: it searches for text based on a pattern. By default it accepts standard input, but you can search in files. The pattern can be a string or a regular expression. It can display both matching and non-matching strings and their context. Any time you run a command that produces a lot of information, you don't need to parse everything manually - let grep do its magic.

22.sort

Sorting lines of text according to various criteria. The most useful options are: -n ( N umeric), by numeric value, and -r ( R everse), which reverses the output. This can be useful for sorting the output of du. For example, if you want to sort files by size, simply combine these commands.

23.wc

Linux command line utility for counting words, lines, bytes and characters.

24. diff

Shows the differences between two files in a line-by-line comparison. Moreover, only the lines in which differences are found are displayed. Changed lines are marked with the symbol "c", deleted ones with "d", and new ones with "a".

By the way, I have prepared another detailed article, which describes it using the terminal.

Linux commands for managing processes

25. kill/xkill/pkill/killall

Serve to terminate processes. But they accept different parameters to identify processes. Kill needs the PID of the process, xkill - just click on the window to close it, killall and pkill take the name of the process. Use the one that is convenient in a certain situation.

26.ps/pgrep

As already mentioned, to kill a process, you need its identifier. One way to get it is with the ps utility, which prints information about running processes. By default the output is very long, so use the -e option to see information about a specific process. This is only a snapshot of the state at the time of the call and the information will not be updated. The ps command with the aux switch displays complete information about processes. Pgrep works like this: you give the process a name, and the utility displays its ID.

27.top/htop

Both commands are similar, both display processes and can be used as console system monitors. I recommend installing htop if your distribution doesn't come with it by default, as it is an improved version of top. You can not only view, but also control processes through its interactive interface.

28. time

Process execution time. This is a stopwatch for program execution. Useful if you are interested in how far your implementation of an algorithm lags behind the standard one. But despite its name, it will not tell you the current time; use the date command for this.

Linux user environment commands

29.su/sudo

Su and sudo are two ways to accomplish the same task: run a program as a different user. Depending on your distribution, you probably use one or the other. But both work. The difference is that su switches you to another user, while sudo only runs the command on their behalf. Therefore, using sudo will be the safest option to work with.

30.date

Unlike time, it does exactly what you'd expect it to do: print the date and time to standard output. It can be formatted depending on your needs: display year, month, day, set 12 or 24 hour format, get nanoseconds or week number. For example, date +"%j %V" will output the day of the year and week number in ISO format.

31. alias

The command creates synonyms for other Linux commands. That is, you can create new commands or groups of commands, as well as rename existing ones. This is very useful for shortening long commands that you use frequently, or creating clearer names for commands that you use infrequently and cannot remember.

32. uname

Displays some basic information about the system. Without parameters, it will not show anything useful except the Linux line, but if you set the -a parameter ( A ll), you can get information about the kernel, hostname and processor architecture.

33.uptime

Tells you the operating time of the system. Not very significant information, but can be useful for random calculations or just for fun to find out how long ago the server was rebooted.

34. sleep

You're probably wondering how you can use it. Even without Bash scripting, it has its advantages. For example, if you want to turn off your computer after a certain period of time or use it as an impromptu alarm.

Linux Commands for User Management

35. useradd/userdel/usermod

These Linux console commands allow you to add, remove, and change user accounts. Chances are you won't use them very often. Especially if this is a home computer and you are the only user. You can manage users using the GUI, but it's better to know about these commands just in case.

36. passwd

This command allows you to change the user account password. As a superuser, you can reset everyone's passwords even though you can't see them. It is a good security practice to change your password frequently.

Linux commands to view documentation

37.man/whatis

The man command opens a manual for a specific command. There are man pages for all basic Linux commands. Whatis shows which manual sections there are for a given command.

38. whereis

Shows the full path to the program's executable file. It can also show the path to the sources, if they are in the system.

Linux Commands for Network Management

39.ip

If the list of Linux commands for network management seems too short to you, you are most likely not familiar with the ip utility. The net-tools package contains many other utilities: ipconfig, netstat and other outdated ones, like iproute2. All this is replaced by one utility - ip. You can view it as a Swiss army knife for networking or as an incomprehensible mass, but either way, it is the future. Just deal with it.

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, an additional mouse tool appeared, which significantly simplified the entire process of information exchange and made it more accessible to all users. Nevertheless, the console today remains a powerful and sometimes very convenient tool for performing all kinds of actions.


In general, there are a great many console utilities, but here we will briefly, as an example, consider only two of them, but they are very important and frequently 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 //updating information about packages from repositories
apt-get upgrade //update all packages
apt-get dist-upgrade //updating the system as a whole
apt-get clean //cleanses local storage, except for 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 look at another very good utility called " 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
find / -user user1 //search 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 Linux, A 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 someone is really interested in this, I can advise you to go to the following link, you can find and download a lot of things there, the only question is whether it is necessary it's all for you. 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).

-> List of Linux Ubuntu 10.04 console commands. Application syntax. System Examples CCTV can be divided into two large groups: systems CCTV on the base DVRs and systems based on personal computers. For relatively small objects with a simple hierarchy, it is advisable to opt for a video recorder. Its structure is approximately as follows: a number of video cameras are connected to a video recorder with a monitor, at which a big-eyed security guard sits and monitors the operational situation. Additionally, over the local network, the image from video cameras is transmitted, for example, to the office of the general manager or system administrator.
But what about when building systems with a complex structure for distributing viewing rights? For example, a security guard controls the view in protected premises, the head of the human resources department looks at the monitor and monitors the work of personnel (including the security guard) in the office, the production director controls production areas, and the image from some video cameras is transmitted to the head office located in another city. In general, a complex distribution of view and write rights is required. It is not so easy to build a video surveillance system using DVRs here. It is economically and technically beneficial to assemble such a system CCTV computer based. Convenient to use as an operating system Linux. There are several reasons for this: the operating system itself is free (as well as the overwhelming number of programs for CCTV) and its reliability. For example, in our office we have a video server based on Linux Ubuntu hasn't been shut down for a year and a half. And still not a single crash or freeze.
We will look at an example of installing a Linux-based video surveillance system in another article. And in this section we collect the most necessary console (terminal) commands Linux Ubuntu and the syntax of their use is considered. It is no secret for Linux users that the most flexible configuration of the operating system is possible in command mode (besides, it is nostalgically reminiscent of working under MS-DOS). Given list of console commands(external programs) and their combinations are constantly being updated. Some commands will require administrator rights or installation of additional packages. The performance of the designs was tested on the Linux operating system Ubuntu 10.04.

Team Application syntax Explanations
examples of using
a2pa2pTranslating Awk to Perl
a2psa2psFormatting a text file for printing on a Postscript printer
acpiacpi [-key]acpi -t - display information about battery charge and temperature for laptops
addgroupaddgroup groupAdding a new user group group to the system
addr2lineaddr2lineConverting program address to file names and line numbers
adduseradduser userAdding a new user user to the system
adminuseradminuserEditing administrators in the TFM database
aliasaliasSpecifying an abbreviation for a command
alsactlalsactlAlsa sound driver control
amdamdMounting file systems automatically
anacronanacronAsynchronous or anachronistic cron (by time interval)
anacrontabanacrontabConfiguration of tasks performed by anacron
aplayaplay –list-devicesDisplaying detailed information about the sound card
apmapmAdvanced Power Management Query
apmdapmdAdvanced Power Management Daemon
appresappres
aproposapropos videonabludenieSearch for the string videonabludenie in the titles and titles of the documentation and display a list of everything found
apt-cdromapt-cdrom
apt-getapt-get [-key] paramOperations with packages.
apt-get update - check for new updates.
apt-get upgrade - update all installed packages.
apt-get dist-upgrade - update with package replacement (upgrade to a new Ubuntu release).
apt-get install packet - install the packet package. You can install multiple packages by separating them with spaces.
apt-get purge packet - remove the packet package and remove configuration files.
apt-get remove packet - remove a package while saving configuration files.
apt-get autoremove - remove unused packages.
apt-get -f install - restore damaged packages.
apt-cdrom install packet - install (update) a package from CD.
apt-get check - check dependency integrity.
apt-get clean - remove downloaded package archive files.
apt-get autoclean - remove old downloaded archived package files
aptitudeaptitude paramA better package manager than apt-get.
aptitude upgrade - check for updates.
aptitude safe-upgrade - install updates.
aptitude help - help output.
aptitude search video - searches for packages in the locale that contain "video" in their name.
aptitude show videonabludenie - displays information about the videonabludenie package.
aptitude why video - outputs packages that require the video package.
aptitude why-not video - displays information about video package conflicts.
aptitude install videonabludenie - installs the videonabludenie package. You can install several, separating them with spaces.
aptitude reinstall videonabludenie - reinstall the videonabludenie package if the package is not working correctly or you need to return the configuration files to their default state.
aptitude remove videonabludenie - remove the videonabludenie package while saving the configuration files.
aptitude purge videonabludenie - remove the videonabludenie package, removing configuration files.
aptitude hold videonabludenie - fix the package version (if you do not need it to be updated).
aptitude unhold videonabludenie - unlock the ability to update the package.
aptitude keep videonabludenie - cancel scheduled actions for a package
aptitude keep-all - the same for all packages.
aptitude download videonabludenie - download the package.
aptitude clean - clears the cache of downloaded packages. It is recommended to perform it periodically.
aptitude autoclean - remove unused packages from the cache.
aptitude safe-upgrade - update packages while maintaining their composition (i.e. unused ones will not be deleted).
aptitude full-upgrade (or aptitude dist-upgrade) - upgrade all packages for which there are new versions. If packages need to be removed, it will be done.
aptitude markauto videonabludenie - mark the package as installed to satisfy dependencies.
aptitude unmarkauto videonabludenie - unmark a package as installed to satisfy dependencies.
ararOperations on archives
archarchComputer architecture display
arparpWorking with the system ARP cache
asasGNU portable assembler
atatOne-shot command scheduler
atqatqDisplaying a list of jobs in the queue for execution
atrmatrmRemoving tasks added with the at command
audit2allowaudit2allowCreating SELinux policy allowing rules
aumixaumixAdjusting Audio Mixer Settings
awkawkSearch language, template processing
badblocksbadblocksChecking the device for bad sectors
bannerbannerOutputting text as ASCII art
basenamebasenameSelect directory from full filename
bashbashGNU Bourne-Again SHell shell
batchbatchExecuting user commands
bcbcC-like language interpreter or calculator
bdftopcfbdftopcfConverting a font for X Window from BDF to PCF format
beepbeepSound from the system speaker
bgbgList of stopped and background tasks; continue running a stopped task in the background
biffbiffNotification of mail arrival and its sender
biodbiodNFS daemon
bmptoppmbmptoppmConverting a .bmp file to pixmap
bunzip2bunzip2Unpacking the file
bzcatbzcatUnpacking files and printing them to standard output
bzip2bzip2Archiving
bzip2recoverbzip2recoverRecovering data from a damaged bzip file
calcal [N]cal - displays the calendar for the current month.
cal N - output the calendar for the Nth year
catcat paramcat > videonabludenie - direct standard input to videonabludenie.
cat videonabludenie - outputs the contents of the videonabludenie file to standard output (on the screen by default).
cat /proc/cpuinfo - information about the CPU.
cat /proc/loadavg - CPU load for the last 1, 5 and 15 minutes
cat /proc/meminfo - memory information.
cat /proc/interrupts - show interrupts.
cat /proc/swaps - show the swap file.
cat /proc/version - display the kernel version.
cat /proc/net/dev - display network interfaces and statistics on them.
cat /proc/mounts - show mounted filesystems.
cat /proc/partitions - show all partitions registered in the system
ccccC compiler
CDCDGo to the catalog.
cd /video - go to the video directory.
cd~ - go to the home directory (/home),
cd - the same.
cd ~user - go to the user's home directory.
cd .. - go to a higher level directory.
cd ../.. - go to the directory two levels higher.
cd - - go to the directory you were in before moving to the current directory
cdparanoiacdparanoia [-key]cdparanoia -B - record audio tracks to wav files.
cdparanoia -- "-5" write the first 5 audio tracks to WAV files
cdrecordcdrecordBurning CDs from images
chatchat [-e] [-E] [-v] [-V] [-t timeout] [-r report-file] [-T phone-number] [-U phone-number2] (-f chat-file | chat-script)Automation of interaction between a computer and a modem
chattrchattr [+key] fileChanging additional file attributes (ext2fs file system)
chattr +a file - allow file to be opened for writing only in append mode.
chattr +c file - allows the kernel to automatically compress/decompress the contents of file file.
chattr +d file - tells the dump utility to ignore the file file while performing a backup.
chattr +i file - makes the file file unavailable for any changes: editing, deleting, moving or creating links to it.
chattr +s file - allows you to make file deletion safe, i.e. the set s attribute indicates that when a file is deleted, the space occupied by the file on the disk will be filled with zeros, which prevents the possibility of recovery.
chattr +S file - when saving changes to the fie file, synchronization will be performed, as when executing the sync command.
chattr +u file - this attribute indicates that when a file is deleted, its contents will be saved and, if necessary, the user will be able to restore it
cdrecordcdrecord [-key] paramcdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force - erase the rewritable RW disk.
cdrecord -v dev=/dev/cdrom cd.iso - burn the ISO image.
cdrecord --scanbus - scan the bus to identify the device
chagechage [-key] YYYY-MM-DD userPassword expiration settings
-d, --lastday LAST_DAY - set the last day of password change to LAST_DAY
-E, --expiredate EXPIRE_DATE - set the account expiration date to EXPIRE_DATE
-h, --help - display help
-I, --inactive INACTIVE - set password inactivity after expiration to INACTIVE
-l, --list - show the "age" of the account
-m, --mindays MIN_DAYS - set the minimum number of days before changing the password to MIN_DAYS
-M, --maxdays MAX_DAYS - set the maximum number of days before changing the password to MAX_DAYS
-W, --warndays WARN_DAYS - set the number of days with a warning to WARN_DAYS
chfnchfn [-f full name] [-r room number] [-w work phone] [-h home phone] [-o other name]Changing your username and information
chgrpchgrp [-key] group of files
or
chgrp [-key] --reference=one file
Changing the group owner of a file.
-c, --changes - same as verbose, but only if a change has occurred
--dereference - change the file pointed to by the symbolic link rather than the link itself (default)
-h, --no-dereference - modifies symbolic links, not the files they refer to
--no-preserve-root do not treat `/" specially (default)
--preserve-root refuse to process `/" recursively
-f, --silent, --quiet - suppress most error messages
--reference=OFILE use the OFILE group instead of explicitly specifying GROUP
-R, --recursive - process files and directories recursively
-v, --verbose - display diagnostic messages for each file
The following switches affect how the directory hierarchy is traversed when the -R switch is specified. If more than one of these keys is specified, only the last one is effective.
-H - if the command line argument is a symbolic link to a directory, jump to it.
-L - follow any symbolic link to a directory encountered
-P - do not follow symbolic links (default)
chmodchmod [-key] ABC fileSet ABC rights to the file (or directory) file, separately for the user (A), group (B) and for everyone (C), where A (B, C) is the sum of the terms “read” = 4, “write” = 2 , "execution"=1. For example, "chmod 777" - read, write, execute for everyone; "chmod 755" - read, write and execute for the owner, read and execute for the group and others. The R switch is used to recursively apply rights to attached files and folders
chownchown [-key] user dirchown -R user dir - change the owner of the directory dir to user.
chown user videonabludenie - assign the owner of the videonabludenie file to user user
chrootchroot new_rootExecutes the cmmnd command with the specified new_root directory as the root directory.
--help - display help
--version show version information
chshchshChanging the login shell. Changes the user's login shell. It determines which command will be launched after the user logs into the system. A regular user can change the login shell only for his own account, a superuser can change the login shell for any account
-s shell is the name of the new shell. If set to empty, the default shell is used
cksumcksum videoVideo file size and checksum
clearclearClearing the screen (if possible)
clockclock [-key]clock -w - save system time in BIOS
cmpcmp file1 file 2Compare two specified files file1 and file2. If they are identical, then no messages are displayed.
colcolFiltering backbreaks from the input stream
colcrtcolcrt
colrmcolrmRemoving columns from a file
columncolumn fileOutputting formatted input text from file file into a five-column list
commcomm [-key] file1 file2Line by line comparison of two files
compositecomposite
compresscompress
convertconvertConverting graphic files
cpcp [-key] file1 file2Copying.
cp file1 file2 - copy file1 to file2
cp -r dir1 dir2 - copy directory dir1 to dir2 and create directory dir2 if it does not exist
cp -a dir1 dir2 - copy directory dir1 to dir2
cpiocpioOperations with archives
cppcppPreprocessor used by the C compiler
croncronTimer (clock) daemon
crontabcrontabChanging the task schedule file (crontab)
csplitcsplitSplitting a file into several parts
ctagsctags
ctrlltdelctrlltdelEmulation of pressing Ctrl+Alt+Del
cutcutOutput selected parts of lines of given files
datedate [MMDDHHmmYYYY.SS]date - display the current date and time.
date 101721552011.33 - set the system date and time MMDDCHHmmYYYY.SS (MonthDayHourMinutesYear.Seconds)
dcdc [-key]Calculator
-e, --expression=EXPR - calculate expression
-f, --file=FILE - count expression in file
-h, --help - display help
-V, --version - output version information
dcrawdcrawDecoding "raw" (.raw) digital photos
dddd
debcdebcOutputting the contents of the generated debian package
debugfsdebugfsFile system recovery
deluserdeluser videonabludenieDeleting user videonabludenie
dfdf [-key]Displaying information about disks
df -h Shows all disks on the system
dfsharesdfsharesList available resources
dhclientdhclient eth0dhclient eth0 - activate interface eth0 in dhcp mode
digdig [-key] domainGet DNS information for domain domain
dig -x host - reverse search for host
diffdiff [-key] file1 file2Comparing two text files. See also patch
diff3diff3Comparison of three text files
dirdirList the files in the current directory in alphabetical order
dircolorsdircolorsSetting colors for the ls command
dirnamedirnameRemove file name from specified path
djviewdjviewFile viewer.djvu
dmesgdmesgDisplaying kernel messages
dmidecodedmidecode [-key]dmidecode -q - output of hardware system components.
dmidecode -s bios-version command to display the name of the manufacturer and the name of the motherboard, BIOS version (DMI).
dmidecode –type 6 - memory type determination
dpkgdpkg [-key] packetOperations with packages.
dpkg --configure -a - restore damaged packages.
dpkg -i packet.deb - install the package from the packet.deb file.
dpkg -r packet - remove a package from the system.
dpkg -l show all packages installed on the system.
dpkg -l | grep videonabludenie - among all packages installed on the system, find a package containing "videonabludenie" in its name.
dpkg -s packet - display information about a specific package.
dpkg -L packet - display a list of files included in the package installed on the system.
dpkg --contents package.deb - display a list of files included in a package that is not yet installed on the system.
dpkg -S /bin/ping - search for the package that contains the specified file
dpkg-querydpkg-query [-key] paramdpkg-query -W -f="$(Installed-Size;10)t$(Package)n" | sort -k1,1n - displays the amount of used disk space occupied by deb package files, sorted by size
dudu [-key dir]du - display the size of the current directory
du -sh dir - display the volume of a specific directory (file) dir in an “easy-to-read” form
dumpdump [-key] dirCreating backups.
dump -0aj -f /tmp/back0.bak /videonabludenie - create a full backup of the /videonabludenie directory to the file /tmp/back0.bak.
dump -1aj -f /tmp/back0.bak /videonabludenie - create an incremental backup of the /videonabludenie directory to the file /tmp/back0.bak. See also restore
echoecho textOutputting text information, performing mathematical operations.
echo a b c | awk "(print $1)" - print the first column. Separation, by default, by space/spaces or character/tab characters.
echo a b c | awk "(print $1,$3)" - print the first and third columns. Separate, by default, by space/spaces or tab/characters.
echo "1" > /proc/sys/net/ipv4/ip_forward - allow packet forwarding
ejectejectOpening a CD or DVD drive
exitexitExit the current session, close the terminal window
fdformatfdformat -n paramfdformat -n /dev/fd0 - formats a floppy disk without checking
fgfg[N]Brings recent tasks to the forefront.
fg N - bring task N to the foreground
findfind [-key] paramSearch files.
find -name "*." | xargs grep -E "video surveillance" - find "video surveillance" in the current directory and in subordinate directories.
find -type f -print0 | xargs -r0 grep -F "video surveillance" - find all files for "video surveillance" in the current directory and below.
find -maxdepth 1 -type f | xargs grep -F "example" - find all files by "example" in the current directory.
find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done - processing each element with several commands (in a while loop).
find -type f ! -perm -444 - search for files that are not visible to everyone.
find -type d ! -perm -111 - search for directories that are not accessible to everyone.
find /path/to/directory -type f -delete &> /dev/null - recursively delete files in a directory and subdirectories without deleting the directory itself and subdirectories.
find /home/backups/ -mtime +N -type f -exec rm -rfv () \ - search and delete old files (older than N days).
find /home/backups/ -mmin +N -type f -exec rm -rfv () \ - search and delete old files (older than N minutes).
find /dir -type d -empty - command to search for empty directories.
find /dir -type d -empty -delete - find and delete empty directories.
find /home -type f -mtime -N - find all files in "/home" created or modified within the last N days.
find /home -type f -atime +N - find all files in "/home" whose last access time is more than N days.
find /home/videonabludenie -name "*.123" | xargs cp -av --target-directory=/home/backup/ --parents - find all files with the extension ".123" in /home/videonabludenie and copy them to the /home/backup directory
ffmpegffmpeg [-key] input [-key] outputConverting (transferring) source (file) input to source (file) output
-i - incoming file
-b - video bitrate
-ar - audio sampling frequency, Hz (default 44100 Hz)
-ab - audio bitrate, kB/s (default 64 kB/s)
-ac - number of audio channels (default 2)
-vcodec - video codec
-acodec - codec for audio
-s - outgoing file size in pixels
-y - replace the outgoing file (if available)
-r - frame rate
-ss - set encoding start time
-t - set encoding duration
-formats - output supported formats and codecs
-h - help
-vn - disable video output
-an - disable sound output
-re-
-f - output file format
-g - the density of key frames by which synchronization is carried out and the higher their frequency (for example, 1 - each key frame) - the better for rewinding, but the file size increases significantly)
-threads - number of cores in the computer
-vframes - limit on the number of video frames
-aspect - output aspect ratio (for example 16:9)
-sn - do not use subtitles
-vlang - select video language
-alang - select sound language
-slang - select subtitle language
-sameq - save video quality
-deinterlace - enable deinterlation
-aq - audio quality
fingerfinger videonabludenieDisplay information about the user videonabludenie (when launched without parameters - about the current user)
freefree [-key]Memory and paging file usage.
free -m - Displays the total amount of memory (RAM, swap), as well as the amount of used and free memory, MB
fuserfuser [-key] /Nfuser -km /mnt/hda2 - force unmounting of a partition occupied by some user
geditgedit videocameraRunning the gedit text editor with the videocamera file open
gitgitListing System X resources
gksugksu commandRunning the command command with administrator rights and displaying a graphical window for entering the password
glxinfoglxinfoDisplaying information about OpenGL and the GLX implementation in XWindows
glxgearsglxgearsA simple 3D test that displays the frame rate in the terminal
gpggpg [-key] filegpg -c video - encrypt the video file.
gpg video.gpg - decrypt the video.gpg file. When executing the command, GNU Privacy Guard is enabled
grepgrep [-key] string filesSearch in files.
grep stroka files - search for stroka in files files
grep -r stroka dir - search recursively for stroka in dir command | grep stroka - look for stroka in command output.
grep -color reference /usr/share/dict/words - highlights the places where the regular expression appears in the dictionary.
grep Aug /var/log/messages from the file "/var/log/messages" select and print to the standard output the lines containing "Aug".
grep ^Aug /var/log/messages from the file "/var/log/messages" select and print to the standard output the lines starting with "Aug".
grep /var/log/messages from the file "/var/log/messages" select and print lines containing numbers to the standard output device.
grep Aug -R /var/log/* select and print to standard output lines containing "Aug" in all files located in the /var/log directory and below
grpckgrpckChecking the correctness of system account files. The file /etc/group is checked
guvcviewguvcviewConnecting a WEB camera
gzipgzip [-key] filegzip file - compress file file and rename it to file.gz
gzip -d file.gz - decompress file.gz into file
halthaltFast and correct system shutdown
hashhashListing System X resources
hdparmhdparm -key hddhdparm -i /dev/hda - displays the characteristics of the first hard drive.
hdparm -tT /dev/sda - performance test for reading data from the hard drive
hddtemphddtemp [-key] paramhddtemp -uC /dev/sda - output temperature for hard drive /dev/sda in degrees Celsius
headhead filePrint the first 10 lines of file file
historyhistoryDisplays a numbered list of commands entered in this and the previous session. If there are quite a lot of them in the history list, then display the latest
hosthost addresshost www..host website to IP address.
host 89.105.147.150 - the same thing vice versa
hostnamehostname [-key]Displays the identifier of this network node. The administrator can change the node ID to a new one.
hostname -i - output current IP address
hwclockhwclockBuilt-in computer clock. To change the date (time) and synchronize with the system clock, administrator rights are required
hwinfohwinfo [-key]hwinfo –-short - display information about connected devices.
hwinfo -wlan - information about wireless devices
ifconfigifconfigLearn about wired network connections.
ifconfig eth0 192.168.10.10 netmask 255.255.255.0 - set the eth0 interface to an IP address and subnet mask.
ifconfig eth0 promisc - switch the eth0 interface to promiscuous mode for “catching” packets (sniffing).
ifconfig eth0 -promisc - disable promiscuous mode on interface eth0
ifdownifdown netDisable net
ifupifup netEnable net
iwconfigiwconfigAbout wireless networks
iwlist scaniwlist scanSearch for wireless networks
javajava [-key] file.jarjava -jar file.jar - launching .jar files
jobsjobsList all running and paused tasks
killkill NTerminate process with id N
killallkillall videoEnd all processes named video
last rebootlast rebootDisplaying system reboot history
less videoless fileOutput the contents of the video file
lnln [-key] file linkln -s videonabludenie video - creates a symbolic link video to the videonabludenie file
locatelocate [-key] filelocate video - find all files named video.
locate -r "file[^/]*\.txt" - search the cached index by names
loginloginRequest from the user for a name and password (request from the system to the user) to log in to the system (by default, when entering a password, it is not displayed)
logoutlogoutLogout from the current shell session
look referencelook referenceQuick search (sorted) dictionary by prefix
lsls [-key]List of files and directories in the current directory.
ls -l - view file information
ls -la - formatted list with hidden directories and files.
ls -F - display the contents of the current directory, adding symbols to the names that characterize their type.
ls -a - show hidden files and directories in the current directory.
ls ** - show files and directories containing numbers in the name
lsb_releaselsb_release [-key]lsb_release -a - command to output the Ubuntu version
lsattrlsattrViewing file attributes
lshw-htmllshw -html > videonabludenie.htmlDisplaying information about hardware in the html file videonabludenie.html
lspcilspci [-key]lspci - displays information about all PCI buses and devices connected to them.
lspci -v - the same thing in more detail.
lspci -vv - display information about installed drivers.
lspci -tv - show PCI devices as a tree.
lspci | grep VGA – displays information about the video card manufacturer.
lspci | grep audio - output information about the sound card.
lspci | grep Ethernet - output information from the Ethernet controller
lsusblsusb [-key]Displays information about the USB bus and connected devices.
lsusb -v - the same thing in more detail.
lsusb -tv - show USB devices as a tree
lsmodlsmodDisplaying the status of kernel modules
manman commandHelp output about the command command
mkdirmkdir videonabludenieCreate a directory videonabludenie
mkswapmkswap /parammkswap /dev/hda3 - creates swap space on the hda3 partition. See also swapon
mke2fsmke2fs /parammke2fs /dev/hda1 - create an ext2 file system on the hda1 partition.
mke2fs -j /dev/hda1 - creates an ext3 journaling file system on the hda1 partition
mkfsmkfs [-key] /parammkfs /dev/hda1 - create a Linux file system on the hda1 partition.
mkfs -t vfat 32 -F /dev/hda1 - create a FAT32 file system on the hda1 partition
moremore filePage-by-page viewing of a text file file
mountmount [-key] /N /MMount partition N to mount point M.
For example, mount /dev/hda2 /mnt/hda2 - mounts the "hda2" partition to the "/mnt/hda2" mount point. The mount point directory must be created first.
mount /dev/fd0 /mnt/floppy - mounts the drive.
mount /dev/cdrom /mnt/cdrom - mounts a DVD or CD.
mount /dev/hdc /mnt/cdrecorder - mount CD-R/CD-RW or DVD-R/DVD-RW(+-).
mount -o loop file.iso /mnt/cdrom - mounts the ISO image.
mount -t vfat /dev/hda5 /mnt/hda5 - mounts the Windows FAT32 file system.
mount -t smbfs -o username=user,password=pass //winclient/share /mnt/share - mount the Windows network file system (SMB/CIFS).
mount -o bind /home/user/prg /var/ftp/user - mounts a directory into a directory (binding). This design is useful, for example, for providing the contents of a user directory via ftp when the ftp server is running in a sandbox (chroot), when symlinks cannot be made
mvmv file1 file2Rename or move file file1 to file2. If file2 is an existing directory - move file1 to file2 directory
nanonano file
netstatnetstat [-key]netstat -rn - display the local routing table
newgrpnewgrp [-]Changes the current user's primary group. If you specify the "-" key, the situation will be identical to that in which the user logged out and logged in again. If you do not specify a group, the primary group will be assigned from /etc/passwd
nlnl fileLine numbering in file file
oclockoclockDisplaying hand clocks on the desktop
osecosecPerforming system integrity monitoring
passwdpasswdChanging the current user's password
pastepaste [-key] file1 file2Merging files file1 and file2.
paste file1 file2 combine the contents of files file1 and file2 in the form of a table: line 1 of file1 = line 1 column 1-n, line 1 of file2 = line 1 column n+1-m.
paste -d "+" file1 file2 - combine the contents of files file1 and file2 as a table with the delimiter "+"
patchpatch [-key] file1 file2Merging two files
pingping hostPing host with result output
poweroffpoweroffCorrect system shutdown
pppoeconfpppoeconfInternet access setup command
psps [-key]List active processes.
ps aux - list all processes
ps -C video - output the PID of the running video process
p.s. | grep -v grep | grep -i %proc - find process %proc (partial name can be used)
pwckpwckChecking the correctness of system account files. The files /etc/passwd and /etc/shadow are checked
pwdpwdShow current directory
rebootrebootCorrect system shutdown and subsequent boot (reboot)
restorerestore [-key] file.bakRestoring files from backups.
restore -if /tmp/back0.bak - restore from backup /tmp/back0.bak
rmrm [-key] fileDelete a file or directory.
rm videonabludenie - delete videonabludenie file
rm -r videonabludenie - delete videonabludenie directory
rm -f file - delete file file without prompting for deletion.
rm -rf videonabludenie - delete the videonabludenie directory without prompting for deletion
rmdirrmdir dirrmdir dir - delete an empty directory dir.
routeroute [-key]route -n - display the local routing table.
route add -net 0/0 gw IP_Gateway set the default gateway IP address.
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.10.10 add a static route to the network 192.168.0.0/16 through the gateway with the IP address 192.168.10.10.
route del 0/0 gw IP_gateway - delete the default gateway IP address
rsyncrsync [-key] /dirFile synchronization.
rsync -rogpav --delete /home /tmp - synchronize /tmp with /home.
rsync -rogpav -e ssh --delete /home ip_address:/tmp - synchronization via SSH tunnel.
rsync -az -e ssh --delete ip_addr:/home/public /home/local - synchronize a local directory with a remote directory via a compressed ssh tunnel.
rsync -az -e ssh --delete /home/local ip_addr:/home/public - synchronize a remote directory with a local directory via a compressed ssh tunnel
sedsed [-key] param fileOperations with text files.
sed "s/string1/string2/g" primer.txt - the command will replace the line "string1" with "string2" in the primer.txt file, output the result to the standard output device.
sed "/^$/d" primer.txt - the command will remove empty lines from the primer.txt file.
sed "/ *#/d; /^$/d" primer.txt - the command will remove empty lines and comments from the primer.txt file.
sed -e "1d" primer.txt - remove the first line from the example.txt file.
sed -n "/string1/p" - display only lines containing "string1".
sed -e "s/ *$//" primer.txt - remove empty characters at the end of each line.
sed -e "s/string1//g" primer.txt - remove the line "string1" from the text without changing anything else.
sed -n "1.8p;5q" primer.txt - take the first to eighth lines from the file and print the first five from them.
sed -n "5p;5q" primer.txt - print the fifth line.
sed -e "s/0*/0/g" primer.txt - replace a sequence of any number of zeros with a single zero.
cat primer.txt | awk "NR%2==1" - when outputting the contents of the file, do not output even lines of the file primer.txt
shsh videonabludenie.runExecute batch file videonabludenie.run
shutdownshudown [-key] paramCorrect system shutdown. Used only when working in console mode. When working in X Window mode, do not use.
shutdown -h hours:minutes & - schedule the system to stop for a specified time.
shutdown -c - cancels a scheduled system shutdown.
shutdown -r now - reboot the system.
sudo shutdown –h +N message - shutdown the computer after N minutes, sending a message to other users
sleepsleep NDelay the start of process execution for N seconds
smartctlsmartctl [-key] paramsmartctl -a /dev/sda - output SMART information for hard drive /dev/sda
sortsort file1 file2 [-key]Sorting the contents of two files.
sort file1 file2 | uniq - sort the contents of two files without showing duplicates.
sort file1 file2 | uniq -u - sort the contents of two files, displaying only unique lines (lines that appear in both files are not printed to standard output).
sort file1 file2 | uniq -d - command to sort the contents of two files, displaying only duplicate lines
sshssh [-key port] user@hostConnect to host as user.
ssh -p port user@host - connect to host on port port as user
ssh-copy-idssh-copy-id user@hostAdd your key to host for user to enable login without password and by keys
startxstartxLaunching the X Window GUI
statstat fileDisplay all available information about the specified file file
svnsvn
susuLogin to the administrator session. Exiting a session - exit command
sudosudo [-key]sudo command - run the command command with administrator rights.
sudo -s is a shell with administrator rights.
sudo -s -u user - shell with user rights.
sudo -k - re-prompt for the administrator password.
sudo -i - login to administrator session
tartar key files1 files2tar cf file.tar files - create a tar archive named file.tar containing files tar xf file.tar - unpack file.tar
tar czf file.tar.gz files - create a tar archive with Gzip compression
tar xzf file.tar.gz - unpack tar with Gzip
tar cjf file.tar.bz2 - create a tar archive with Bzip2 compression
tar xjf file.tar.bz2 - unpack tar with Bzip2
swaponswapon/paramswapon /dev/hda2 /dev/hdb3 - activate swap spaces located on hda2 and hdb3 partitions
tailtail [-key] filePrint the last 10 lines of file file.
tail -f file - print the contents of file as it grows, starting with the last 10 lines
toptopShow all running processes
touchtouch [-key] YYMMDDhhmm filetouch videocamera - create a file videocamera.
touch -t 1105092355 file - change the creation date of the file file. If the file does not exist, then create a file with the specified date and time
treetreeDisplay a tree of files and directories starting from the root directory
tzselecttzselectRunning the time zone selection utility
ufwufw paramFirewall management.
ufw enable - enable the firewall.
ufw disable - turn off the firewall.
ufw default allow - allow all connections by default, except those explicitly prohibited.
ufw default deny - deny by default all connections except those explicitly allowed.
ufw status - displays the current state and firewall rules.
ufw allow port - open port port.
ufw deny port - block port port.
ufw deny from ip_address - block the IP address ip_address
umountumount [-key] /NUnmounting partition N. You must leave it before executing the command. For example, umount /dev/hda2.
umount -n /mnt/hda2 - performs unmounting without entering information into /etc/mtab. It is necessary when the file has read-only attributes or there is not enough disk space.
unameuname [-key]uname -a - show kernel information.
uname -r - output kernel version
uname -m - display the computer architecture
uptimeuptimeDisplays current time, session duration, number of users and CPU usage
usersusersDisplaying a short list of currently working users
vmstatvmstatDisplay information about processes, memory and CPU usage
wwDisplaying detailed information about all users currently working and also simple login, etc. If you need one user, then specify the user name in the parameter
wallwallSending messages to the terminal of each user currently logged in
wc filePrinting the number of lines, words and characters in a file
wgetwget [-key] filewget videonabludenie - download file videonabludenie
wget -c videonabludenie - continue the stopped download of the videonabludenie file
winewineLaunching DOS and Windows programs.
winefile - open the Windows desktop.
whatiswhat's the lineSearch a database of manual pages and display a short description
whereiswhereis commandSearch for files, man pages for a specified command
whichwhich paramwhich command - output the path to the command file.
which prog - which prog application will be launched by default
whowhoDisplaying a list of users currently working in the system
whoamiwhoamiDisplaying the name under which you are logged in
whoiswhois domainDisplay whois information for domain
whereiswhereis progPossible location of the prog program
writewrite stringSending messages to another user who is logged in by copying lines from the sender's terminal to the recipient's terminal
xrandrxrandrList of supported graphics resolutions
yasmyasm [-key] fileAssembler
& cmmnd [-key]&Executes the cmmnd command in the background (daemon). Subsequent commands are executed without waiting for cmmnd to finish (for example, when used in a batch file)
&& cmmnd1 && cmmnd2Starting the sequential execution of several commands in one line, with each subsequent command beginning its execution provided that the previous one has completed successfully. For example, the design
./configure && make && sudo make install
identical to sequential execution of commands
./configure
make
sudo make install
!! !! Repeat the last command entered
# # Write a comment herePrefix before entering a comment
; cmmnd1; cmmnd2Line by line recording of several commands. Each subsequent command runs after the previous one completes
|| cmmnd1 || cmmnd2Line by line recording of several commands. The next command is run only after the previous one has completed erroneously
7z7zLaunching the 7z archiver

Permanent page address

Whoami #display the name under which you are registered date #display the date and time time<имя программы>#execute a program or command and get information about the time #required for its execution who #determine which user is running on the machine uname -a #display information about the operating system version cat /etc/issue #show the operating system version (12.04, 13.04 etc .) lsb_release -a #distribution name and version uname -m #find out how many bits are in Linux OS free #display information on memory usage df -h #display information about free and used disk space uptime #shows the current time, elapsed time after loading the OS, the number of current #users in the computer system and the load for the last 1, 5 and 15 minutes top (htop) #displays a list of processes running in the system and information about them ps axu | grep php #list of processes whose name contains php ps aux | head -n 1; ps aux | grep:searchd #processes with explanation of parameters above netstat -lnp | grep:9000 #find out what's hanging on port 9000 netstat -luntp #shows all open ports with applications using them lsusb #information about devices connected via USB lscpu #processor characteristics

Here I will only briefly describe the main commands. You can learn more about most commands interactively by accessing the Linux help system using the man command. To make it easier to remember, from the word man ual:

Man<имя изучаемой команды>

To execute some commands, such as setting access rights to system files and much more, you need permissions superuser. To execute a command on behalf of superuser, you need to write before the command name sudo(for example: sudo service nginx restart). On some Debian systems, sudo may not be installed by default (but can be installed with apt-get install sudo). To install sudo you need to log in using root`om:

When prompted for a password, you must enter the superuser password. After which any command will be executed as the root superuser.

Eugene@PCname:~$ su - Password: root@PCname:~#<команда, которая выполнится от имени root>

Common Linux Commands

Here is a list of useful commands that are not included in other sections.

Sudo shutdown -h now #shut down the computer now sudo shutdown -h 90 #shut down the computer in 90 minutes. sudo reboot #reboot the computer wget --convert-links -r http://www.linux.org/ #copying the entire site and converting links to work offline #copying is 5 levels deep!! #execute last executed command history | tail -50 #show the last 50 typed commands passwd #changes the password of the current user cal -3 #shows the previous, current and next month in a convenient form (like a calendar)

Working with Linux files and directories

ls #show a list of files in the current directory (list) ls -la<имя каталога>#list of files in the directory<имя каталога>, including hidden pwd #prints current path (current directory command) cd [directory] #change current directory (change directory) cp<что_копировать> <куда_копировать>#copy files (copy) mv<что_перемещать> <куда_перемещать>#move or rename file (move) mkdir<каталог>#create a new directory (make directory) rmdir<каталог>#remove directory rm<файлы>#delete files (remove) rm -rf<имя каталога>#removing a directory along with its subfiles locate /var/www*index.php #find all files with names ending in index.php #in the directory /var/www tail<имя файла>#prints the end of the file. Convenient when working with logs and large du files. -bh | more #display information about the size of files and directories, starting from the current directory sudo chmod 777 -R ~/Public #read/write/execute permission for everyone on the directory ~/Public # -R - recursively, that is, on everything subfiles and folders sudo chown<имя пользователя> <имя файла>#set file owner >filename #makes filename an empty file, i.e. erases the contents of touch filename #creates an empty file, also changes the time the file was last modified

Linux commands that give information about the system

whoami #display the name under which you are registered date #display the date and time time<имя программы>#execute a program or command and get information about the time #required for its execution who #determine which user is running on the machine uname -a #display information about the operating system version cat /etc/issue #show the operating system version (12.04, 13.04 etc .) lsb_release -a #distribution name and version uname -m #find out how many bits are in Linux OS free #display information on memory usage df -h #display information about free and used disk space uptime #shows the current time, elapsed time after loading the OS, the number of current #users in the computer system and the load for the last 1, 5 and 15 minutes of work after boot, #the number of current users in the computer system and the load for the last 1, 5 and 15 minutes top (htop) #displays a list of workers in the system of processes and information about them ps axu | grep php #list of processes whose name contains php ps aux | head -n 1; ps aux | grep:searchd #processes with explanation of parameters above netstat -lnp | grep:9000 #find out what's hanging on port 9000 netstat -luntp #shows all open ports with applications using them lsusb #information about devices connected via USB lscpu #processor characteristics

How to terminate a process? If during withdrawal top press k (from the word kill), you will be prompted

PID to kill:

you need to enter the process identifier (PID) and then press enter. This is something like the task manager in Windows.

Working with Linux archives

tar cf primer.tar /home/primer.txt #create a tar archive named primer.tar, #containing /home/primer.txt tar czf primer.tar.gz /home/primer.txt #create a tar archive with Gzip compression by #name primer.tar.gz tar xf primer.tar #unpack the primer.tar archive into the current folder tar xzf primer.tar.gz #unpack the tar archive with Gzip tar xjf primer.tar.bz #unpack the tar archive from Bzip2

Examples of searching text and files in Linux

grep -rl "what are we looking for" /path #search for files recursively with the text #"what are we looking for" along the path "/path" less ~/Documents/http.txt | grep -A 2 "skype" #search the file ~/Documents/http.txt, #will display the matching line + 2 next lines tail -f -n100 ~/logs/php-error.log #very convenient feature for reading logs #in prints the last 100 lines of the find file in real time. -name "*.php" -mtime -1 -print #recursive search for files using the pattern (mask) "*.php" #that have changed in the last 24 hours find /var/www/ -mtime -10 #search for files that have been changed in the last 24 hours last 10 days find /var/www/ -mtime -10 > filename.txt #write output to file find . -perm 777 | xargs rm #find all files with permissions 777 and delete them find . -name cache | xargs chmod -R 777 #find the cache directory and give it permissions 777

Execute pieces of code on the command line (php, python):

Php -r "var_dump(strlen("hello"));" python -c "print("hello");"

This is an incomplete list of commands that have already been very useful to me. As we learn Linux, the post will be updated with other commands.

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. We have already sorted it out and of course after that we need to study the basic commands in the console, this is what we will do today.

Using console commands, 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, modifying the software and visual part of the system, and much more.

Remember that to fully use the console you need administrator rights. Below is a list of the main commands in the Linux console and their explanation.

System information:

arch or uname -m- display computer architecture
uname -r- display the kernel version used
dmidecode -q- show hardware system components - (SMBIOS / DMI)
hdparm -i /dev/hda- display the characteristics of the hard drive
hdparm -tT /dev/sda- test the performance of reading data from the hard drive
cat /proc/cpuinfo- display information about the processor
cat /proc/interrupts- show interrupts
cat /proc/meminfo- check memory usage
cat /proc/swaps- show swap file(s)
cat /proc/version- display the kernel version
cat /proc/net/dev- show network interfaces and statistics on them
cat /proc/mounts- display mounted file systems
lspci-tv- show PCI devices as a tree
lsusb -tv- show USB devices as a tree
date- display system date
date 041217002007.00*- set the system date and time MMDDDHHmmYYYY.SS (MonthDayHourMinutesYear.Seconds)
clock -w- save system time in BIOS

Stopping the system:

shutdown -h now or init 0 or telinit 0- stop the system
shutdown -h hours:minutes &- schedule the system to stop for a specified time
shutdown -c- cancel the scheduled shutdown of the system
shutdown -r now or reboot- reboot the system
logout- log out

Working with the network:

ssh- provides secure entry into a remote session with another machine, and also allows you to execute a given command on a remote machine without entering a session.
scp- provides secure copying of files on the network.
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.
hostname -i- shows the IP address of the computer you are working on.

Some administration commands:

alias ls="ls -Fskb -color"- create an alias so that you can run a more complex combination of commands with one command.
kapasswd- command to change the password for accessing the AFS file system. When working on a basic Linux LIT cluster, you should only use this command to change the password for logging into the cluster.
passwd- change your password on any local computer.
chmod<права доступа> <файл> - change access rights to a file of which you are the owner.
chown<новый_владелец> <файлы> - change the owner of the files.
chgrp<новая_группа> <файлы> - change the group for the file.

Files and directories:

cd /home- go to the directory ‘/home’
cd..- go to a higher directory
cd ../..- go to the directory two levels higher
CD- go to home directory
cd ~user- go to user's home directory
cd -- go to the directory you were in before moving to the current directory
pwd- show current directory
ls- display the contents of the current directory
ls -F- display the contents of the current directory with symbols added to the names
ls -l- show a detailed view of files and directories in the current directory
ls -a- show hidden files and directories in the current directory
ls**- show files and directories containing numbers in the name
tree or lstree- show a tree of files and directories, starting from the root (/)
mkdir dir1- create a directory named ‘dir1’
mkdir dir1 dir2- create two directories at the same time
mkdir -p /tmp/dir1/dir2- create a directory tree
rm -f file1- delete file named 'file1'
rmdir dir1- delete directory named ‘dir1’
rm -rf dir1- delete the directory named ‘dir1’ and recursively all its contents
rm -rf dir1 dir2- delete two directories and their contents recursively
mv dir1 new_dir- rename or move a file or directory
cp file1 file2- copy file file1 to file file2
cp dir/* .- copy all files in directory dir to the current directory
cp -a /tmp/dir1 .- copy directory dir1 with all contents to the current directory
cp -a dir1 dir2- copy directory dir1 to directory dir2
ln -s file1 lnk1*- create a symbolic link to a file or directory
ln file1 lnk1- create a “hard” (physical) link to a file or directory

Process control:

p.s. | grep<Ваше_имя_пользователя> - display all processes running on the system on behalf of the user
kill - “kill” the process. First, determine the PID of your “killed” process using ps
killall<имя_программы> – “kill” all processes by program name
xkill (in X window terminal)- “kill” the process whose window you point to with the cursor

Linux built-in software utilities and languages:

emacs (in X terminal)- emacs editor. Very feature rich, but quite complicated for inexperienced users
gcc - GNU C compiler
g++ - GNU C++ compiler
perl- a very powerful scripting language. Extremely flexible, but with quite complex syntax. Very popular among advanced users.
python- a modern and quite elegant object-oriented interpreter
g77- GNU FORTRAN compiler
f2c- converter from FORTRAN to C
fort77- FORTRAN compiler. Runs f2c and then uses gcc or g++
grep- search for a text fragment in files that matches the typed mask. The mask is defined using a standard notation called "regular expressions"
tr- translation utility (replacing letters in a text file)
gawk- GNU awk (used to process formatted text files)
sed- a utility for processing text files.