FAQ Ubuntu Linux

Versions
How to check the kernel Linux
How to check the distribution Ubuntu
How to check a program version in Linux
X Window System: the graphical shell
How to check the X type in Ubuntu
How to stop / restart X-server in Ubuntu
How to switch from the X server to the console
How to switch from the console to the X server
Swap monitors
Files
File types in Linux
-c character
-d directory
-b block
Find where a file is
Move files but not directories
Create several files
rm: delete a file
How to clear a file in Linux
Count the lines
cat, echo: concatenate files
Merge .pdf files
truncate: create a file of a given size
Check the encoding of a file
Change the encoding of a file
diff: compare files
find: find files
Directories (folders)
How to create a directory in Linux
How to create a directory with a subdirectory in Linux
How to copy a directory in Linux
How to enter a directory
Network
How to list active connections
How to change the gateway
How to list open ports
How to send a file over ssh in Ubuntu
Users
List all Linux users
Create a user
Delete a user
Change a user password
List the groups of a user
Add a user to a group
Scripts
How to run a script
How to stop a script
Errors
ifconfig command not found Linux
bash: man: command not found
bash: adduser: command not found
Other
Where the Grub bootloader lives in Linux
The password of a live image
How to send email from the console of
How to stop a program
How to check free disk space in Linux
How to send data from Linux
How to set up sudo
How to add a Russian keyboard layout

The live usb user password

Try

live

It worked on 26.12.2014 for this image.

Send email in Linux

To send an email, type in the command line

mail -s "Subject" user@domain.ru

If you need to send the contents of a text file

mail -s "Subject" user@domain.ru < /home/user/filename.txt

How to quit a program in Linux

To stop a running program, press

CTRL + C

How to check free disk space in Linux

df

Or install gparted

apt-get install gparted

gparted

How to send data from Linux

Suppose there is an old server somewhere that simply listens on some port, and you need to send data to it.

You have worked out the protocol, or none is needed. You saved the data to the file message.msg

Call the server address url and the port port

First install netcat

netcat url port < message.msg

or

cat message.msg| nc url port

Example

netcat devserver 8085 < message.msg

How to restart the X server

You can restart the X server (switch to the console with Ctrl + Alt + F1 first) with the command

/etc/init.d/gdm restart

or

/etc/init.d/gdm3 restart

or

/etc/init.d/kdm restart

How to stop the X server

You can stop / start the X server (switch to the console with Ctrl + Alt + F1 first) with the command

/etc/init.d/gdm stop

or

/etc/init.d/gdm3 stop

or

/etc/init.d/kdm stop

If you do not know which X server you have, try:

/etc/init.d/gdm stop || /etc/init.d/gdm3 stop || /etc/init.d/kdm stop || /etc/init.d/xdm stop || /etc/init.d/lightdm stop

If that did not help either, try the options from here

or from here.

How to start the X server

/etc/init.d/gdm start

or

/etc/init.d/gdm3 start

or

/etc/init.d/kdm start

This works if your display manager is gdm, gdm3 or kdm. If you have another one, just replace the name.

How to switch from X to the console

Ctrl + Alt + F1

How to switch from the console to X

Alt + F7

How to run a script

Suppose your script file is called my_script.sh and you are in the same directory

./my_script_sh

If you are in another directory, give either the absolute path to the file my_script.sh or the path relative to your location.

Examples:

/home/$(whoami)/my_script.sh

../my_script.sh

How to stop a script

If you started the script yourself from this terminal, run

CTRL + C

If the script was started by someone else or from another terminal and you do not remember which one, but you know the script name, run

ps -aux

Find the number of the process and close it with kill

kill 1234

Searching by hand usually takes long, so I recommend grep

ps -aux | grep your_script.py

Only the lines that contain your_script.py remain. Note the process number (or numbers) and run

kill 1234

With awk you can make this simpler:

kill `ps -aux | grep your_script.py | awk '{print $2}'`

Here ps -aus shows the list of processes.

grep your_script.py finds all processes started from the script your_script.py

awk '{print $2} prints the process number shown in the second column

History

The X Window System is a windowing system that provides the standard tools and protocols for building a graphical user interface. It is used in UNIX-like operating systems.

The X Window System provides the basic functions of a graphical environment: drawing and moving windows on the screen and handling input devices such as the mouse and the keyboard.

The X Window System does not define the details of the user interface. Window managers do that, and many of them have been written. For this reason programs under the X Window System can look very different depending on the features and settings of a particular window manager.

The X Window System is network transparent: graphical applications can run on another machine in the network, while their interface is sent over the network and shown on the local machine of the user.

In the X Window System the terms "client" and "server" have a meaning many users find unusual: the "server" is the local display of the user (the display server), and the "client" is a program that uses this display (it may run on a remote computer).

The X Window System was developed at the Massachusetts Institute of Technology (MIT) in 1984.

As of February 2016 the protocol version, X11R7.7, dated from June 2012.

The X project is led by the X.Org Foundation. The reference implementation of the system is freely available under the MIT License and similar licenses.

The X Window System is often called X11 or simply «X».

Article author: Andrei Olegovich