Menu
For free
Registration
home  /  Multimedia/ File manager in linux terminal window. Command line

File manager in linux terminal window. Command line

BeeSoft Commander 2.23

BeeSoft Commander young project, uncomplicated file manager, written in the spirit of the UNIX-way. According to the unwritten rule, the program should perform only its direct duties and nothing more.

The file manager uses the QT library and is very fast to launch from the KDE environment. The toolbar is not customizable, but it contains virtually all the main functions of the program. You can work with multiple tabs. The right mouse button is responsible for selecting files a tribute to the old tradition of Norton Commander. Many file operations are performed using function keys, according to the old standard, also laid down by Peter Norton.

BeeSoft Commander contains a good FTP client, which allows you to connect to multiple servers, save connection settings. The developers didn't bother with the implementation of viewing and editing various documents. With the built-in editor, you can only change text documents. If other types of files are found, the program either switches to HEX mode or displays a chaotic character set. Editing is not available.

BeeSoft Commander does not require complex configuration. You can specify the fonts and colors of the panels, adjust the width of the columns. And, in fact, this is where all the fun of traveling through the settings ends.

Official site:

Worker is one of the most unusual file managers. The first thing you should immediately pay attention to is the absence of the need to install any additional graphic libraries besides X11.

All management of the file manager is concentrated in numerous buttons located at the bottom of the application's working window. By clicking on the status bar, you switch groups of buttons. Each button calls a separate function. The functions can be both built-in Worker tools and external utilities designed for processing files.

Worker is tightly integrated with Midnight Commander and allows you to use the archive processing rules of the console file manager. Also, by default, MC is used as a file editor (Edit File function).

The Worker distribution only includes a text file viewer. All other actions (viewing graphics and videos, editing any type of data...) are at the mercy of external programs. The default text editor is xedit, which is not surprising. xedit also only uses the X11 library.

Among the predefined functions (buttons) you can find audio information conversion, graphics conversion, device mounting and much more.

The file manager is very unusual, which, of course, makes it difficult to learn from scratch. On the other hand, all competitors either use powerful graphics libraries(QT, GTK), or work in text mode. Worker in this light seems to be a kind of compromise solution.

pivot table

GUI+ + + + + + - + - + +
Graphics LibraryQTGTK2GTK1GTK2QTQT- GTK2- GTK2X11
Tabs+ - - - + + - - + - -
FTP client+ - - + + + + + - - +
FTP:// protocol- - - - + + - + - - -
SMB:// protocol- - - + + + - + - - -
HTTP:// protocol- - - - + - - - - - -
Document thumbnails- - - - + + - + - - -
Text editor+ + - - - + + - + - -
Viewing images- - - + + - - - - - -
Video viewing- - - - + - - - - - -
View HTML- - - - + + + - - - -
View RTF- - - - + + - - - - -
View DOC- - - - + + + - - - -
HEX editor- - - - - - - - + - -
File type highlighting- - + + - - - - + - -
Quick Folders (Bookmarks)- + - + + + + + - + -
Folder History- + + + + + + + + - -
Frequently visited folders- - - - + + - - - - -
Panel (menu) quick launch- - - - + + + - + - -
Plugins- + - + + + + - - - -
multitasking- - + + + + + + - - -
BeeSoft Commander 2.23
emelFM2 0.1.6
Gentoo 0.11.55
GNOME Commander 1.2.0
Konqueror 3.5.2
Krusader 1.70.0
Nautilus 2.12.2
Tux Commander 0.4.101
Text File Managers and Worker

Original: Midnight Commander - A Console Based File Manager for Linux
Author: Pungki Arianto
Publication date: October 23, 2013
Translation: A. Krivoshey
Transfer date: May 2013

If you have to work with big amount files in a console environment, you may find this job quite tedious. The graphical environment has file managers that help improve the speed of working with files. You don't have to remember the name and syntax of every file-related command.

In a console environment for working with files, you must know the basic commands and their syntax. Fortunately, Linux also has text file A new manager that works in a console environment. He is called Midnight Commander (hereinafter we will simply call him MC).

Section headings

The Midnight Commander website says:
"GNU Midnight Commander is a visual file manager distributed under the GPL and therefore qualifies as Free Software. It is a powerful, text-based, full-featured program that allows you to copy, move, and delete files and directories, search for files, and run shell commands .A built-in editor and file viewer are also included."

How to Install Midnight Commander on Linux

By default, MC is usually not installed. On Debian, Ubuntu and Linux Mint you can install it with apt-get commands:

$ sudo apt-get install mc

On RHEL, CentOS and Fedora you can use the command:

# yum install mc

Once the installation is complete, simply type "mc" (without the quotes) in the console to run it.

Midnight Commander features

MC has many useful features for both users and administrators.

Copy, delete, rename/move, create directories

The MC interface is divided into two columns independent of each other. Each column represents an active directory. You can switch between them with the Tab key. At the bottom of the screen, you can see buttons with numbers that refer to the function keys F1 - F10.
To copy a file from one directory to another, simply select it and press "F5". To copy several files at once, you must first select them using the "Insert" key.

MC will ask you for confirmation. To start copying, just click "OK".
Deleting files is even easier. Just select the files and press "F8". Moving files is done using the "F6" key.
However, renaming files is slightly different. By pressing the "F6" key, you need to enter a new file name. An example of how this is done is shown in the screenshot below.

You can press "F7" to create a directory. MC will create a new directory in the current one. To see what else MC can do with files, press "F9" > File.

Built-in file viewer

Many text editors are available in console mode, such as vi, joe, and nano. MC has its own built-in program for viewing the contents of text files. To run it, select the file and press "F3". You can also edit the file if necessary by selecting it and pressing "F4".
When you run text editor the first time, MC will ask you to select a default text editor:

[email protected]~ $Select an editor. To change later, run "select-editor". 1. /bin/ed 2. /bin/nano

Then, when you press the "F4" key, MC will use the text editor of your choice. If you want to change the default editor, just press "F2", you take "@" and type "select-editor" (without the quotes).

What if you want to use another text editor not detected by MC? Let's say you want to work with Vi. This can be done differently. Find the ".selected_editor" file in your home directory. This hidden file, so it starts with a dot. Edit it like this:

# Generated by /usr/bin/select-editor SELECTED_EDITOR="/usr/bin/vi"

File permissions

Files and directories have permissions that specify who can read, write, and execute files and directories. The command for managing access rights is chmod. To learn how to use it, type "man chmod" in the terminal.
In MC you only need to highlight the file, then press "F9" > File > Chmod or "Ctrl-x" and "c". MS will show you the current permissions of the selected file and options that you can change.

File owner

Files and directories have their own owner, as well as the group of the owner. Owner privileges are controlled using the chmod command described above. Owners are managed with the chown command.
As usual, to learn how to use it, type "man chmod" in the terminal. In MC you just need to highlight the file, then press "F9" > File > Chown, or "Ctrl-x" and "o". You can now set the owner and owner group from the list of available users and groups.

MC also has an "Advanced Chown" feature, which is a combination of chmod and chown that allows you to do the two tasks described above in one place. Press "F9" > File > Advanced Chown.

By default, the MC has a two-panel interface. These panels are not just for local directories. You can connect them to a remote computer via FTP.
In this case, the MC acts as an FTP client. To connect you need to press "F9" > FTP Link. The MC will request connection data in the following format:

user: [email protected] _or_ip_address

If the entered data is correct, in one of the panels you will see a list of directories of the remote computer.

To disable the FTP connection, you can press "F9" > Command > Active VPS Link. You will see your FTP connection in the list of Active VFS directories. Select it and click "Free VFSs". If you just want to switch to a local directory without breaking the FTP connection, select "Change to".

If your network uses a proxy server, you can configure the MC to work with a proxy. Press "F9" > Options > Virtual FS > Always use ftp proxy.

Exit Midnight Commander

To exit Midnight Command, press "F9" > File > Exit or "F10".

For a more detailed introduction to MC features, please visit the Midnight Commander FAQ.

There are two kinds of interface: graphical user interface and command line interface.

Graphical user interface (Eng. Graphical user interface, GUI).- control programs using graphic buttons, pop-up menus, windows and other elements. Many actions can be performed with the mouse.

Advantages: visual display of programs and their contents, program features can be studied without reading the documentation.

Command line interface (English Command Line Interface, CLI).- program management using commands. Commands consist of letters, numbers, symbols, are typed line by line, are executed after pressing the Enter key. The main instrument here is the keyboard.
This interface is built into the system kernel, it will be available even if the graphical interface does not start.

Advantages: low resource consumption, flexibility in compiling a list of actions from commands, the ability to automatically execute commands, the ability to copy and paste commands.

When comparing interfaces in different systems, you can see that the basic commands are the same in all distributions of the Linux family, but the graphic programs on each system can vary greatly.

There are two ways to get to the command line: through the console or the terminal.

Console

During Ubuntu boot, seven full-screen consoles are launched, each with its own independent session, the first through the sixth with a command line interface, the seventh starts the graphical mode. The user sees only the graphical mode during the boot.
You can switch to one of the virtual consoles by pressing the key combination:
Ctrl+Alt+F1 - first virtual console;
Ctrl+Alt+F2 - second virtual console;
Ctrl+Alt+F3 - third virtual console;
Ctrl+Alt+F4 - fourth virtual console;
Ctrl+Alt+F5 - fifth virtual console;
Ctrl+Alt+F6 - the sixth virtual console;
Ctrl+Alt+F7 - the seventh virtual console, return to graphics mode.

Terminal

Terminal - graphics program emulation console.
Such programs allow you to execute commands without leaving the graphical mode.
The terminal, compared to the console, has additional functionality (mouse control, context menu, scrollbar, tabs, launch multiple windows, main menu, graphic settings).

You can start the terminal like this:

In Unity:
Main menu → Dial to search line word terminal
or press the key combination: Ctrl + Alt + T

In Gnome Fallback
Applications → Accessories → Terminal

In Xfce (Xubuntu):

In KDE (Kubuntu):
Main Menu → Applications → System → Terminal

In LXDE (Lubuntu):
Main menu → System → LXTerminal

After starting the terminal, we see a line with an invitation to enter commands, for example:
[email protected]:~$

vladimir - user account name
@ - separator between account and computer name
Zotac-Zbox-Nano - computer name
: - delimiter
~ - in which folder the command is executed, ~ is the user's home folder, if you run the ls command, you will get a list of files from this folder
$ - an invitation to execute a command with rights simple user(# will mean a prompt to run commands with admin rights)

Hotkeys

Copy commands

Often you will have to follow some instructions that require you to copy commands to the terminal. You will probably be surprised when you find that the text you copied from a web page using the combination Ctrl keys+ C, is not pasted into the terminal when pressing Ctrl + V . And what, do you really have to retype all these commands and file names manually? No, relax! There are three ways to paste text into the terminal: Ctrl + Shift + V , pressing the middle mouse button or right mouse button and selecting the Paste line.

Set savings

or ctrl+pscroll up recently used commands
↓ or Ctrl + Nscroll down recently used commands
Enterexecute the selected command
Tabextremely convenient opportunity- autocompletion of commands and file names. If only one command starts with the selected characters, it will be substituted, and if there are several, then double-clicking tab will display a list of all possible options.
ctrl+rsearch for commands you have entered before. If you need to re-execute a very long and complex command, you can enter only part of it, and this keyboard shortcut will help you find the entire command.
History Team history prints out a list of all the commands you entered. Each team will be assigned a number. To run command number x, just type "!x". If your story is too long, you can try "history I'm less", this will make the list scrollable.

Text change

The mouse doesn't work here. Use the left/right arrows to move through the line.

Keyboard input will add characters. Existing text will not be deleted.

Shell

The console and terminal process commands using a shell program.
A shell program is a command interpreter, it recognizes commands entered on the command line, and launches programs to execute the command.
Ubuntu uses the bash shell by default, and it recognizes commands in the bash language.
Bash can be replaced by another shell, there are several. Each shell has its own set of settings and features.
(auto-execution of commands when entering the shell, internal commands shells, history keeping, you can assign abbreviated commands - aliases).

Teams

Commands are a predefined set of letters, numbers, symbols that can be entered on the command line and executed by pressing enter.

Commands are divided into two types:

    Commands built into the shell (eg history)

    Commands that control programs installed on the system

Commands for managing programs are built according to the following scheme:

Program_name - key value

Program name- this is the name of the executable file from the directories recorded in the $PATH variable (/bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, etc.) or full path To executable file(/opt/deadbeef/bin/deadbeef)
Key- is written after the name of the program, for example -h, each program has its own set of switches, they are listed in the help for the program, the switches are used to indicate which settings to use or what action to perform
Meaning- address, numbers, text, special characters (*, ~, \, &, "", _), variables ($HOME, $USER, $PATH)

You can run commands like this:

    Type the command on the command line and press Enter

    Copy the command from the instruction and paste it into the command line, then press Enter

    Create a script and double-click (create a text file, write #!/bin/bash in the first line, write commands in a column below, save, enable execution in the file properties, double-click on the file to execute all the listed commands)

Remember that the terminal is case sensitive! The words User, user and USER are different in Linux!

Command Cheat Sheet

File commands

cd ../.. go to the directory two levels above
cd go to home directory
cd ~user go to user's home directory
cd- change to the directory where you were before changing to the current directory
pwd show current directory
mkdir dir create directory dir
mkdir dir1 create a directory named "dir1"
mkdir dir1 dir2 create two directories at the same time
mkdir -p /tmp/dir1/dir2 create directory tree
rm file delete file
rm -r dir remove directory dir
rm -f file force delete file
rm -rf dir force delete directory dir
rm -f file1 delete file named "file1"
rmdir dir1 remove directory named "dir1"
rm -rf dir1 delete directory named "dir1" and recursively all its contents
rm -rf dir1 dir2 remove two directories and recursively their contents
cp file1 file2 copy file1 to file2
cp -r dir1 dir2 copy dir1 to dir2; will create directory dir2 if it doesn't exist
cp dir/ copy all files in dir directory to current directory
cp -a /tmp/dir1 copy directory dir1 with all contents to current directory
cp -a dir1 dir2 copy directory dir1 to directory dir2
mv dir1 new_dir rename or move a file or directory
mv file1 file2 rename or move file1 to file2. if file2 is an existing directory - move file1 to directory file2
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
touch file create file
touch -t 0712250000 fileditest modify the date and time of the file creation, if it is missing, create a file with the specified date and time (YYMMDDhhmm)
cat > file pipe standard input to file
more file withdraw file content
head file output the first 10 lines of file
tail file output the last 10 lines of file
tail -f file print the contents of file as it grows, starting from the last 10 lines

Archiving

tar cf file.tar files create a tar archive named file.tar containing files
tar xf file.tar unpack file.tar
tar cf file.tar.gz files create a tar archive with gzip compression
tarxzf 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
gzip file compress file and rename to file.gz
gzip -d file.gz decompress file.gz to file
bunzip2 file1.bz2 decompresses the file "file1.gz"
gzip -9 file1 compress file1 with maximum compression
rar a file1.rar test_file create a rar archive "file1.rar" and include the test_file file in it
rar a file1.rar file1 file2 dir1 create a rar archive "file1.rar" and include file1, file2 and dir1 in it
rar x file1.rar unpack rar archive
tar -cvf archive.tar file1 create a tar archive archive.tar containing the file file1
tar -cvf archive.tar file1 file2 dir1 create a tar archive archive.tar containing file1, file2 and dir1
tar -tf archive.tar show the contents of the archive
tar -xvf archive.tar unzip the archive
tar -xvf archive.tar -C /tmp unzip archive to /tmp
tar -cvfj archive.tar.bz2 dir1 create an archive and compress it with bzip2
tar -xvfj archive.tar.bz2 unzip the archive and unpack it
tar -cvfz archive.tar.gz dir1 create an archive and compress it with gzip
tar -xvfz archive.tar.gz unpack the archive and unpack it
zip file1.zip file1 create a compressed zip archive
zip -r file1.zip file1 file2 dir1 create a compressed zip archive and include several files and / or directories in it
unzip file1.zip decompress and unpack the zip archive

Working with local deb packages (dpkg)

deb - filename extension of "binary" packages for distribution and installation software on the OS of the Debian project, and others using the dpkg package management system. Deb is part of the word Debian, which in turn is derived from the words Debra - the name of the girlfriend (later wife, now ex) of Debian founder Ian Murdoch and Ian from his own name.

dpkg -i package.deb install/update a package
dpkg -r package_name remove the package from the system
dpkg -l show all packages installed on the system
dpkg -l | grep httpd among all packages installed in the system, find the package containing "httpd" in its name
dpkg -s package_name display information about a specific package
dpkg -L package_name 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 find the package that contains the specified file

Using the Apt Package Manager

apt (advanced packaging tool) - a program for installing, updating and removing software packages on Debian and based operating systems (Ubuntu, Linux Mint, etc.), sometimes also used on Mandrake based distributions such as Mandriva, ALTLinux and PCLinuxOS. It is capable of automatically installing and configuring programs for UNIX-like operating systems, both from precompiled packages and from source codes.

apt-get install package_name install/update a package
apt-cdrom install package_name install / update package from cdrom"a
apt-get update get updated package lists
apt-get upgrade update packages installed on the system
apt-get remove package_name remove the package installed on the system while preserving the configuration files
apt-get purge package_name remove the package installed on the system with the removal of configuration files
apt-get check check integrity of dependencies
apt-get clean delete downloaded archive files packages
apt-get autoclean delete old downloaded package archive files

Viewing the Contents of Files

cat file1 print the contents of file1 to standard output
tac file1 output the contents of file1 to standard output in reverse order (last line becomes first, etc.)
more file1 paging the contents of file1 to standard output
less file1 page-by-page output of the contents of the file file1 to the standard output device, but with the ability to scroll in both directions (up and down), search by content, etc.
head -2 file1 print the first two lines of file1 to standard output. The default is ten lines.
tail -2 file1 print the last two lines of file1 to standard output. The default is ten lines.
tail -f /var/log/messages print the contents of the file /var/log/messages to standard output as text appears in it

Text manipulation

cat file_original | >result.txt general syntax for performing actions to process the contents of a file and output the result to a new
cat file_original | » result.txt general syntax for performing actions to process the contents of a file and output the result to an existing file. If the file does not exist, it will be created
grep Aug /var/log/messages from file "/var/log/messages" select and output to standard output the lines containing "Aug"
grep ^Aug /var/log/messages from file "/var/log/messages" select and print to standard output lines starting with "Aug"
grep /var/log/messages from file "/var/log/messages" select and print to standard output strings containing numbers
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
sed "s/stringa1/stringa2/g" example.txt in the example.txt file, replace "string1" with "string2", output the result to standard output
sed "/^$/d" example.txt remove blank lines from example.txt file
sed "/ *#/d; /^$/d" example.txt remove blank lines and comments from example.txt file
echo "esempio" | tr "[:lower:]" "[:upper:]" convert characters from lowercase to uppercase
sed -e "1d" result.txt remove first line from example.txt file
sed -n "/string1/p" display only lines containing "string1"
sed -e "s/*$ "example.txt | remove empty characters at the end of each line | | | sed -e "s/string1 g"example.txt remove the string "string1" from the text without changing everything else
sed -n "1,8p;5q" example.txt take from the file from the first to the eighth lines and output the first five from them
sed -n "5p;5q" example.txt output the fifth line
sed -e "s/0*/0/g" example.txt replace a sequence of any number of zeros with a single zero
cat -n file1 number lines when outputting file contents
cat example.txt | awk "NR%2==1" when displaying the contents of a file, do not output even lines of the file
echo a b c | awk "(print $1)" display the first column. Separation, by default, by space/spaces or tab character/characters
echo a b c | awk "(print $1,$3)" display the first and third columns. Separation, by default, by space/spaces or tab character/characters
paste file1 file2 combine the contents of file1 and file2 into 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 concatenate the contents of file1 and file2 as a table delimited by "+"
sort file1 file2 sort the contents of two files
sort file1 file2 | uniq sort the contents of two files without displaying duplicates
sort file1 file2 | uniq-u sort the contents of two files, displaying only unique lines (lines that occur in both files are not printed to standard output)
sort file1 file2 | uniq -d sort the contents of two files, displaying only duplicate lines
comm -1 file1 file2 compare contents of two files without displaying lines belonging to "file1"
comm -2 file1 file2 compare contents of two files without displaying lines belonging to "file2"
comm -3 file1 file2 compare the contents of two files, removing lines that occur in both files

Convert character sets and file formats

File system analysis

Mounting file systems

Mounting file system- a process that prepares a disk partition for use operating system.

The mount operation consists of several steps:

    Determining the type of system to be mounted

    Checking the integrity of the mounted system

    Reading system data structures and initializing the corresponding file manager module (file system driver)

    Setting a flag that indicates the end of the mount. When properly unmounted, this flag is cleared. If during boot the system determines that the flag is not reset, then the work was completed incorrectly, and the FS may need to be repaired

    Including a new file system in the common namespace

mount /dev/hda2 /mnt/hda2 mounts partition "hda2" to mount point "/mnt/hda2". Make sure there is a mount point directory "/mnt/hda2"
umount /dev/hda2 will unmount the "hda2" partition. Before executing, leave "/mnt/hda2"
fuser -km /mnt/hda2 forced unmounting of the partition. Used when the partition is occupied by some user
umount -n /mnt/hda2 unmount without adding information to /etc/mtab. Useful when a file is read-only or there is not enough disk space.
mount /dev/fd0 /mnt/floppy mount floppy disk
mount /dev/cdrom /mnt/cdrom mount CD or DVD
mount /dev/hdc /mnt/cdrecorder mount CD-R/CD-RW or DVD-R/DVD-RW(+-)
mount -o loop file.iso /mnt/cdrom mount ISO image
mount -t vfat /dev/hda5 /mnt/hda5 mount file Windows system FAT32

Formatting file systems

Formatting is a software process of marking the data storage area of ​​electronic media located on a magnetic surface ( hard disks, diskettes), optical media(CD/DVD/Blu-ray discs), solid state drives(flash memory - flash module, SSD), etc. There are different ways this process.

Formatting itself consists in creating (forming) data access structures, for example, file system structures. In this case, the possibility of direct access to the information located (before formatting) on ​​the storage medium is lost, part of it is irretrievably destroyed. Some software utilities make it possible to recover some part (usually a large part) of information from formatted media. The formatting process can also check and correct the integrity of the media.

Creating backups (backup)

Backup (English backup copy) - the process of creating a copy of data on a medium (hard disk, floppy disk, etc.) designed to restore data to its original or new location in case of damage or destruction.

dump -0aj -f /tmp/home0.bak /home create a complete backup directory /home to file /tmp/home0.bak
dump -1aj -f /tmp/home0.bak /home create an incremental backup of the /home directory to the file /tmp/home0.bak
restore -if /tmp/home0.bak restore from backup /tmp/home0.bak
rsync -rogpav --delete /home /tmp sync /tmp with /home
rsync -rogpav -e ssh --delete /home ip_address:/tmp sync via ssh tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize local directory with remote directory via ssh tunnel with compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize remote directory with local directory via ssh tunnel with compression
dd bs=1M if=/dev/hda | gzip | ssh [email protected] _addr "dd of=hda.gz" make a "blind" local disk to a file on a remote computer through an ssh tunnel
tar -Puf backup.tar /home/user create an incremental backup of the "/home/user" directory to a backup.tar file with permissions preserved
(cd /tmp/local/ && tar c .) | ssh -C [email protected] _addr "cd /home/share/ && tar x -p" copying the contents of /tmp/local to remote computer via ssh tunnel to /home/share/
(tar c /home) | ssh -C [email protected] _addr "cd /home/backup-home && tar x -p" copying the contents of /home to a remote computer via ssh tunnel to /home/backup-home
tar cf - . | (cd /tmp/backup ; tar xf -) copying one directory to another while maintaining permissions and links
find /home/user1 -name "*.txt" | xargs cp -av --target-directory=/home/backup/ --parents search /home/user1 for all files whose names end in ".txt" and copy them to another directory
find /var/log -name "*.log" | tar cv --files-from=- | bzip2 > log.tar.bz2 search /var/log for all files whose names end in ".log" and create a bzip archive from them
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 create an MBR (Master Boot Record) copy from /dev/hda to a floppy disk
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from floppy to /dev/hda

Disk space

df-h displays information about mounted partitions showing total, available and used space
ls -lSr |more lists files and directories recursively, sorted in ascending order of size, and allows pagination
du -sh dir1 calculates and displays the size occupied by the directory "dir1"
du -sk* | sort-rn displays the size and names of files and directories, sorted by size
rpm -q -a –qf "%10(SIZE)t%(NAME)n" | sort-k1,1n shows the amount of used disk space occupied by the files of the rpm package, sorted by size (fedora, redhat, etc.)
dpkg-query -W -f="$(Installed-Size;10)t$(Package)n" | sort-k1,1n shows the amount of used disk space occupied by the files of the deb package, sorted by size (ubuntu, debian etc.)

CDROM

mkisofs /dev/cdrom > cd.iso create iso image disk
mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso disk image
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd create an iso image of a folder
cdrecord -v dev=/dev/cdrom cd.iso burn iso image
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom burn compressed iso image
mount -o loop cd.iso /mnt/iso mount iso image
cd-paranoia -B read audio tracks from disk to wav files
cd-paranoia - "-3" read the first three audio tracks from the disc into wav files
cdrecord -scanbus identify scsi channel

Users and groups

groupadd group_name create new group named group_name
groupdel group_name delete group group_name
groupmod -n new_group_name old_group_name rename group old_group_name to new_group_name
useradd -c "Nome Cognome" -g admin -d /home/user1 -s /bin/bash user1 create a user user1, assign it /home/user1 as a home directory, /bin/bash as a shell, include it in the admin group and add the comment Nome Cognome
useradd user1 create user user1
userdel -r user1 delete user1 user and his home directory
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 change user attributes
passwd Change password
passwd user1 change user1 password (root only)
chage -E 2005-12-31 user1 set the expiration date for user1's account
pwck check correctness system files accounts. /etc/passwd and /etc/shadow files are checked
grpck checks the correctness of system account files. The file /etc/group is checked
newgrp [-] group_name changes the primary group current user. If you specify "-", the situation will be identical to the one in which the user logged out and logged in again. If no group is specified, the primary group will be assigned from /etc/passwd

Setting/Changing File Permissions

chmod (from English change mode) - a program for changing the access rights to files and directories. The name comes from the Unix chmod OS program, which, in fact, changes the access rights to files, directories and symbolic links.

ls-lh view permissions on files and directories in the current directory
ls /tmp | pr -T5 -W$COLUMNS output the contents of the /tmp directory and split the output into five columns
chmod ugo+rwx directory1 add permissions to the directory directory1 ugo(User Group Other)+rwx(Read Write eXecute) - all full rights. The same can be done in this way chmod 777 directory1
chmod go-rwx directory1 take away from the group and everyone else all permissions to the directory directory1
chown user1 file1 assign the owner of file1 to user1
chown -R user1 directory1 assign recursively the owner of directory1 to user1
chgrp group1 file1 change the owner group of file1 to group1
chown user1:group1 file1 change owner and owner group of file1
find / -perm -u+s find, starting from the root, all files with SUID set

Popular Meanings

400 (-r---) The owner has the right to read; no one else has the right to do anything
644 (-rw-r–r–) All users have read access; owner can edit
660 (-rw-rw--) Owner and group can read and edit; the rest are not allowed to perform any action
664 (-rw-rw-r–) All users have read access; owner and group can edit
666 (-rw-rw-rw-) All users can read and edit
700 (-rwx--) The owner can read, write and execute; no one else has the right to do anything
744 (-rwxr–r–) Each user can read, the owner has the right to edit and execute
755 (-rwxr-xr-x) Each user has the right to read and execute; owner can edit
777 (-rwxrwxrwx) Each user can read, edit and execute
1555 (-r-xr-xr-t) Each user has the right to read and execute; only the owner of that file can delete a file
2555 (-r-xr-sr-x) Each user has the right to read and execute with the rights of the user group of the owner of the file
4555 (-r-sr-xr-x) Each user has the right to read and execute with the rights of the owner of the file

Secure Shell Commands (ssh)

SSH (eng. Secure Shell - “secure shell”) is an application-level network protocol that allows you to produce remote control operating system and tunneling TCP connections (for example, for file transfers). Similar in functionality to the Telnet and rlogin protocols, but unlike them, it encrypts all traffic, including transmitted passwords. SSH allows a choice of different encryption algorithms. SSH clients and SSH servers available for most network operating systems.

SSH allows you to securely transfer almost any other network protocol in an insecure environment. Thus, you can not only work remotely on a computer through a command shell, but also transmit an audio stream or video over an encrypted channel (for example, from a webcam). SSH can also use compression of transmitted data for subsequent encryption, which is convenient, for example, for remote launch of X Window System clients.

Most hosting providers provide customers with SSH access to their home directory for a fee. This can be convenient both for working in the command line and for remotely launching programs (including graphical applications).

Process management

A process is a program that is currently running. The ISO 9000:2000 standard defines a process as a set of interrelated and interacting activities that transform inputs into outputs. The computer program itself is only a passive collection of instructions, while a process is the direct execution of those instructions. Also, a process is a running program and all its elements: address space, global variables, registers, stack, open files, etc.

top show all running processes
ps print your current active processes
ps-eafw display running processes, their resources, and other useful information(once)
ps -e -o pid,args -forest display PID's and processes as a tree
pstree display process tree
kill -9 98989 "kill" the process with PID 98989 "to death" (without respecting data integrity)
kill -TERM 98989 Gracefully terminate process with PID 98989
kill -1 98989 force the process with PID 98989 to reread the config file
lsof -p 98989 display a list of files, open process with PID 98989
lsof /home/user1 display list open files from /home/user1 directory
strace -c ls >/dev/null print a list of system calls created and received by the ls process
strace -f -e open ls >/dev/null display library calls
watch -n1 "cat /proc/interrupts" display interrupts in real time
last reboot display system reboot history
last user1 display the registration history of user1 user in the system and the time of his stay in it
lsmod list loaded kernel modules
free-m show status random access memory in megabytes
smartctl -A /dev/hda condition monitoring hard drive/dev/hda via SMART
smartctl -i /dev/hda check availability of SMART on hard drive /dev/hda
tail /var/log/dmesg print the last ten entries from the kernel boot log
tail /var/log/messages print the last ten entries from the system log

Network (LAN and WiFi)

ifconfig eth0 show eth0 network interface configuration
ifup eth0 activate (elevate) interface eth0
ifdown eth0 deactivate (lower) interface eth0
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 set eth0 interface ip address and subnet mask
ifconfig eth0 promise switch the eth0 interface to promiscuous mode to sniff packets
ifconfig eth0 -promisc disable promiscuous mode on interface eth0
dhclient eth0 enable eth0 interface in dhcp mode
route-n display local routing table
route add -net 0/0 gw IP_Gateway set default gateway ip address
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 add static route to network 192.168.0.0/16 through gateway with ip address 192.168.1.1
route del 0/0 gw IP_gateway remove default gateway ip address
echo "1" > /proc/sys/net/ipv4/ip_forward allow packet forwarding (forwarding)
hostname display computer name
host www.linuxguide.it resolve hostname www.linuxguide.it to ip address and vice versa *host 62.149.140.85*
ip link show* display the status of all interfaces
mii tool eth0 display status and connection type for interface eth0
ethtool eth0 displays eth0 interface statistics with information such as supported and current connection modes
netstat -tupn displays all established network connections via TCP and UDP protocols without name resolution to ip-addresses and PIDs and the names of the processes providing these connections
netstat-tupln displays all network connections via TCP and UDP protocols without name resolution to ip-addresses and PIDs and the names of processes listening on ports
tcpdump tcp port 80 display all traffic on TCP port 80 (usually HTTP)
iwlist scan scan the air for the availability of wireless access points
iwconfig eth1 show eth1 wireless network interface configuration

Microsoft Windows networks(SAMBA)

IPTABLES (firewall)

iptables is a command line utility that is standard interface work management firewall(firewall) netfilter for Linux kernels versions 2.4, 2.6, 3.x, 4.x . Superuser (root) privileges are required to use the iptables utility.

iptables -t filter -nL display all rule chains
iptables -t nat -L display all rule chains in NAT table
iptables -t filter -F clear all chains of rules in the filter table
iptables -t nat -F clear all rule chains in the NAT table
iptables -t filter -X delete all custom rule chains in the filter table
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow incoming telnet connection
iptables -t filter -A OUTPUT -p tcp –dport http -j DROP block outgoing HTTP connections
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow forward POP3 connections
iptables -t filter -A INPUT -j LOG --log-prefix "DROP INPUT" enable kernel logging of packets passing through the INPUT chain and prefix the message with "DROP INPUT"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE enable NAT (Network Address Translate) of outgoing packets on the eth0 interface. Valid when used with dynamically allocated ip addresses
iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp –dport 22 -j DNAT –to-destination 10.0.0.2:22 forwarding packets addressed to one host to another host

System Information

arch display computer architecture
uname -r display the kernel version in use
dmidecode -q show hardware system components- (SMBIOS/DMI)
hdparm -i /dev/hda display hard drive specifications
hdparm -tT /dev/sda test the performance of reading data from the hard drive
cat /proc/cpuinfo display processor information
cat /proc/interrupts show interrupts
cat /proc/meminfo check memory usage
cat /proc/swaps show swap file(s)
cat /proc/version print the kernel version
cat /proc/net/dev show network interfaces and statistics on them
cat /proc/mounts display mounted filesystems
lspci-tv show in tree view PCI devices
lsusb-tv show in tree view USB devices
date display system date
cal 2007 display the table-calendar of 2007
date 041217002007.00 set system date and time MMDDHHmmYYYY.SS (MonthDayHourMinutesYear.Seconds)
clock-w save system time in BIOS
uptime show current uptime
w show users online
whoami the name under which you are logged in
finger user show information about user
uname-a show kernel information
cat /proc/cpuinfo CPU information
cat /proc/meminfo memory information
man command show manual for command
df show inf. about disk usage
du display the "weight" of the current directory
free memory usage and swap
where is app possible location of app
which app which app will be launched by default

System shutdown

Other useful commands

apropos …keyword displays a list of commands that somehow relate to keywords. Useful when you know what the program does but don't remember the command
man ping calling the manual for working with the program, in this case, ping
whatis …keyword displays a description of the actions of the specified program
ldd /usr/bin/ssh list libraries needed for ssh to work
alias hh="history" assign alias hh to history command
find. -maxdepth 1 -name *.jpg -print -exec convert Resizing all images in a folder, passing to ImageMagick's "convert" utility to create thumbnails of images (preview)
swapon /dev/hda3 activate the swap space located on the hda3 partition
swapon /dev/hda2 /dev/hdb3 activate swap spaces located on hda2 and hdb3 partitions

View Help and Program Guide

The names of programs used in commands that may come in handy need to be learned or printed, and how to use them can be found at any time by calling the help or manual (man) for the program.

To get a quick guide to the program, you need to run:

man program

You can move around with the arrow keys, and exit it by pressing the Q key. See man man for more details.

To get help with the keys, you need to run:

program -h program --help

Both options should work the same, but some software authors leave one of these keys, so try both if that.

Search by man "s

If you are not sure which command you need, try searching through the texts of the manuals.

    Man-k something-you-need

    will look for what you need in all manuals. Try:

    Man -k nautilus

    to see how it works. By the way, this is the same as running the apropos command.

    Man -f something-you-need

    will search only by the names of the system manuals. Try:

    Man -f gnome

    For example, executing the whatis command will produce the same result.

More attractive man's

Gnome/Unity desktop users can use the yelp utility to provide a simple GUI by running the command in the console

Yelp man:<команда>

Users who have Konqueror installed can read and search the pages of the manual in a web browser context decorated with selected backgrounds. To do this, type Konqueror in the address bar and use the command:

Man:/<команда>

Execute commands with unlimited privileges

Most of the commands listed below require the following command:

This temporarily grants superuser rights, which are necessary to work with files and directories that do not belong to your account. Using sudo requires a password. Only users with these administrative privileges can use this command.

Commands for working with files and folders

    The tilde character (~) represents your home folder. If you user, then the tilde (~) is /home /user.

    The pwd ("print working directory") command lets you know which directory you are in this moment. Remember, however, that Gnome Terminal always shows the same information in the window title.

    ls will show you all the files in the current directory. If you use this command with certain options, you can also enable the display of file size, time last change and file permissions. For example: ls ~

    will show everything you have in your home folder.

    The cd command changes the working directory. When you first start the terminal, you will be in your home folder. To move around the file system, you need to use cd . Examples:

    1. To get into the root directory, run: cd /

      To get to your home folder, type: cd ~

      To move up one directory, use: cd ..

      To return to the previously visited directory, use: cd -

      To move through multiple directories at once, you need to write the full path of the folder you want to move to. For example, the command: cd /var/www

      will move you to the /www subdirectory of /var/. And the command:

      Cd ~/Desktop\table

      will take you to the desktop. In this case, "\" means escaping a space.

    The cp command copies a file. For example, the command: cp text new

    will create an exact copy of the file "text" and name it "new", while "file" will not disappear anywhere. To copy a directory, use the command:

    Cp -r directory new

    where the -r option denotes a recursive copy.

    The mv command moves a file to another location, or simply renames a file. For example, the command: mv file text

    will rename "file" to "text".

    Mv text ~/Desktop\Desktop

    will move "text" to your desktop, but will not rename it. To still rename the file, you need to specifically specify a new name for it. You can replace the path to your home folder with "~" to speed things up. Remember that when using mv along with sudo , the terminal also maps "~" to your home folder. However, if you enable the root session in the console with sudo -i or sudo -s , then "~" will refer to the root of the drive, not your home directory.

    The rm command deletes a file.

    The rmdir command removes an empty folder. To delete a folder along with all attachments, use rm -r instead.

    mkdir This command creates a directory. The mkdir music command will create a folder for you called "music".

    Man try this command when you want to read the inline description of another command. For example: man man

    will show you the description of that command itself.

System Information Commands

    Team df shows the amount of disk space used on all mounted partitions. Most useful: df -h

    Because it uses Megabytes (M) and Gigabytes (G) to display, not blocks. -h means "human readable".

    du displays the amount of disk space used specific folder. It can show information for all subdirectories separately or for the folder as a whole. .. [email protected]:~$ du /media/floppy 1032 /media/floppy/files 1036 /media/floppy/ [email protected]:~$ du -sh /media/floppy 1.1M /media/floppy/

    S means "summary" (as a whole), and -h means "human readable" ("human readable").

    free displays the amount of free and used RAM. Command: free -m

    shows information in megabytes.

    top displays information about your system, running processes, and system resources, including CPU load, RAM and swap usage, and number of running processes. To stop top , press Q .

There are also some other wonderful and very necessary utilities designed in the top style:

    htop similar to top , much more powerful

    if top information about active network connections, network upload/download speed

    iotop information about processes performing active disk operations

    uname with the -a option prints all system information, including machine name, kernel version, and other details. The most useful of these is checking the kernel version.

    passwd newuser

Building a directory tree (tree)

The utility displays a directory tree in a beautifully formatted form. The tree package is in Ubuntu repositories, so the installation is done in one line:

sudo apt-get install tree

To display a directory tree, the command should look like this:

tree -dA test

All of us, both server administrators and users conventional computers very often we deal with files. It is important to work with files in an environment that is comfortable for us, as this process can take quite a long time. We often open, delete, move and rename files. Therefore, in this article, let's look at how to choose a file manager for Ubuntu. Ubuntu comes with Nautilus by default, but it may not suit everyone with its look and functionality, we will look at seven more different file managers, as well as how to install them.

Not everyone knows about the wide choice of file managers for Linux. Or they do not fully realize the capabilities of those programs that they know about. There are different file managers for Ubuntu and there are plenty of them, as well as other programs. Here are the most popular ones:

  • Midnight Commander
  • Dolphin

They are all excellent file managers. There are both simple and multifunctional ones. You can choose the file manager that suits your needs. Midnight Commander and Dolphin are my favorite file managers. I use them quite often.

All of these file managers can be customized to your liking. The most customizable are Krusader and Konqueror. Midnight Commander is the only file manager with a console interface, but it also has a lot of settings.

How to change the default file manager in Ubuntu

If you decide to change the ubuntu file manager to another one, this is not so difficult. Install the program you like, and tweak a few files so that the context menu works with the new file manager.

And you need to fix the files:

/usr/share/applications/nautilus-home.desktop
/usr/share/applications/nautilus-computer.desktop

Replace lines:

TryExec=nautilus
Exec=nautilus

TryExec=file_manager
exec=file manager

And now the same in the file:

/usr/share/applications/nautilus-folder-handler.desktop

TryExec=file_manager
Exec=file_manager %U

In Kubuntu, the default file manager is configured in System Options. And now let's go directly to the review of file managers for Ubuntu.

Midnight Commander

Midnight Commander is a file manager with a command line interface (cli). It is especially useful when it is not possible to run graphical shell, but can also be used as the main file manager in GUI. It can be run in almost any command line shell and even in an SSH session.

You can run Midnight Commander from the command line by running:

The screenshot above shows Midnight Commander in a single tab of the Ubuntu terminal emulator. User interface The program is divided into two panels, each of which displays the contents of a directory. The current directory is displayed at the top of each panel. Navigation is done using the arrow keys. The Enter key is used to open a folder.

At the very top of the program there is a menu with options for setting the program, left and right panels, as well as various operations for files. The bottom part of the window displays information about the selected file or directory, as well as a row of function keys. You can simply press the desired function key to quickly perform a particular action. Also here you can see the terminal line, for quickly executing commands in the current directory.

You can install Midnight Commander with the command:

sudo apt-get install mc

Krusader is an exceptional file manager that uses Midnight Commander concepts in a graphical interface. It also uses a two-pane interface, but also supports many additional features. It supports navigation using the keyboard and, as usual, using the mouse.

Krusader also has two panels that display the contents of a directory, but there are also tabs that allow you to open multiple folders in one panel.

On each tab, you can set the file display mode. In the screenshot, the files are displayed in detailed mode - icon, name, size, creation date, owner and access rights.

There is also a menu at the top of the window, and a line of function keys and a terminal at the bottom. Krusader automatically saves the current directories and display settings, so when you open the program, you will return to the folders with which you closed it last time.

Useful features include support FTP protocols and samba, which makes it easy to access files on remote servers.

To install this best file ubuntu manager run:

sudo apt-get install krusader

It is important to note that it is written in Qt, and will pull with it the entire Qt and several KDE libraries.

Konqueror is another powerful file manager from standard set KDE. He has one interesting feature- in addition to accessing files, you can enter a url here and view Internet pages.

Another feature of this file manager is the ability to open several tabs, in each of which you can open a separate directory.

In the picture, the program window is divided into three parts on the right and a sidebar on the left. The directory tree sidebar is used for fast navigation by file system.

I especially like Konqueror's sidebar, which makes it easy to find required files, navigate the file system, and quickly remove unnecessary directory trees.

The program's interface is similar to Krusader and Midnight Commander, but there is much less functionality. Instead of two standard tabs, here you can create multiple panels and place them as you wish. You can navigate through tabs and directories using both the keyboard and the mouse.

Here, too, the file display mode is configured for each individual tab, but there is no automatic saving. But you can manually save the location and tabs that you want to run every time you start the program.

To install on Ubuntu, use the command:

sudo apt-get install konqueror

Double Commander

This is another great file manager in the style of Midnight Commander and Krusader. But this time it's based on the GTK library, which means it's great for those who want a great, feature-packed file manager and don't want to haul half of the KDE libraries into the system.

The interface is divided into two panels. Exceptional features include a built-in text editor, support for viewing files in HEX and binary formats, and support for working with archives. It also supports various networking capabilities such as Webdav, FTP, Samba connection.

To install, run the following commands:

sudo add-apt-repository ppa:alexx2000/doublecmd
$ sudo apt-get update
$ sudo apt-get install doublecmd-gtk

Dolphin

This is another file manager from KDE. Its interface is very similar to Konqueror, but more beautiful and functional. Here, too, it is possible to create several panels and tabs. There is also a sidebar with shortcuts quick access to the file system.

By default, only one panel opens, but nothing prevents you from adding another one and making Dolphin look like Krusader. But splitting panels like in Konqueror is not supported here.

Although tabs are supported here, they are not saved even after restarting the program, it starts with one tab in which your home folder is open.

Dolphin is installed with the command:

sudo apt-get install dolphin

Nautilus is the default in Ubuntu and couldn't help but say a few words about it. Here you can use there is support for multiple panels and tabs, there is also a sidebar with shortcuts. This is a simple and stable file manager, great for beginners because of its simplicity.

Navigation through the directories is carried out using the arrows on the keyboard or mouse. There are hot key combinations, but there are not as many of them as in Double Commander.

This is another lightweight and simple file manager. Perhaps even easier than Nautilus. It looks and works the same.

You can install it on Ubuntu with the command:

sudo apt-get install thunar

Another moderately simple Ubuntu file manager. Looks the same as the previous two. Supports tabs and most of the features for easy file handling.

On the left side of the screen there is a panel with a tree view of the file system, just like in Konqueror. This file manager contains great functionality and at the same time a very simple interface.

To install, run:

sudo apt-get install pcmanfm

XFE

This is one of the more interesting file managers. In its interface it includes many features from Nautilus, Thunar and PcManFm but at the same time it is much more flexible.