Debian
My Debian user diary where I'm trial, error and consultation Solve problems with friends as they arrive here
Debian Installation
Assume that your OS before installing Debian is
Windows
Before installing Debian, you must first
partition
.
There are several programs that can easily do this from under the Windows:
free
Easeus
Acronis Disk Director or Partition Magic.
They can create partitions visible from both Windows and Linux.
First you need to create a logical disk.
In addition to the one on which Windows is installed.
The above programs are able to separate a piece
empty space from your system disk. For example, if you initially have
Disk C: - You need to create Disk D:
Next, I believe that you have already created a clean disk of the right size.
On this disk we create three sections:
| Number. № section | Conventional name | Size |
|---|---|---|
| Purpose of | File system | |
| 1 | Paging file. | Size recommend Doing twice as much as your working memory |
| Secondary storage for inactive fragments RAM | SWAP | |
| 2 | Debian | Gigs 10-20. Don't be petty. |
| Section directly wherein the Debian shall be established. | A file system is usually one of: ext4 ext3 ext2 ReiserFS Reiser4 Tru-Linuxoids can arrange a scab and cholivar on which is better, but ordinary users do not If you want to do this, you need to put ext4. | |
| 3 | General section | The rest of the disk space. |
| Partition for storing information that will be available from Windows from Debian | File system FAT32. It'll be visible from both. OS Initially. or NTFS. You may need to install a driver for it. |
Once the sections are ready, you need a Debian distribution. It is important to choose the right architecture:
- amd64 - for a 64-bit system
- i386 - for 32-bit
There are different types of distributions, I usually use netinstall.
here
netinstall is suitable for those who want to install the basic system, and
add the necessary packages yourself
If you want to install everything at once, then download the DVD image.
here
One of the things I really liked was the installation of
website
When installing a disk that you highlight under itself
Debian will need to select a mounting point /
An administrator analog in Windows is a root user in Debian.
Make your password harder (such as QWERTY)
so that hackers do not start capturing your future server (there was a precedent☺).
N.B. If you have 2 or more network cards, Debian will offer to configure one.
They're in place.
If you know,
which is currently connected to the network cord - configure it.
I advise you to pay attention to all the proposed names.
Read the details in the article
«Configuration of the network in Linux»
Installation of programmes
The easiest way to install is from the repository.
Updates and other joys are downloaded by the so-called package manager.
APT.
(Commands look like apt-get and aptitude.)
The file with the list of addresses from where apt-get can download updates lies in the directory
/etc/apt/
It's called sources.list wiki
You can open the file in at least two ways:
Go to the directory /etc/apt/
cd /etc/apt
To open the file
vi sources.list
Or use it right away. vi , indicating the full path to the file
vi /etc/apt/sources.list
Nano is a text editor, an analogue of a notebook in a Windows.
Install the program from the repository
apt-get install program_name
Delete
apt-get remove program_name
Instead of removing, you can use purge - this is a stronger removal.
If the repository cannot be installed, there are two ways:
insert
sources.list
Or download the program from the Internet. When downloading, options are also possible:
If you download a .deb package, you need to go to the directory with it (or add it to command)
dpkg -i package_name.deb
apt-get install package_name
Source installation
Detailed.
here
I advise you to study this issue so that you do not suffer later.
In short: if you download the source, you need to place them in the folder /usr/src
Go to the source folder and dial
./configure
make
make install
Use Make Install Better With Linux Experience
If you have already established graphical environment It is not the same as GUI, it is not superfluous. There are at least two sets of Qt libraries for KDE and GTK - for Gnome, Xfce4 et al.
When choosing the program you want to install, ask. (for example, go to the its official website or wikipedia page based on which library The program is created - in simple terms, which environment it will be easier to work with.
Example: I put Xfce4 and Ktorrent on it.
It's counterintuitive, it's usually Transmission, I'm a video player.
Choose xine (apt-get install)
gxine) is right.
It is also important to note that different programs may require
setting up some preliminary actions, preferably before
Installation to make a search query "How to install the name Programs Version Debian"
When installing programs from source materials, pre-installation is often required.
gcc
and Linux-headers
apt-get install linux-$(uname -r)
apt-get install gcc
From under the graphic shell can be launched synaptic and install packages from there.
You can install manual programs. For example, download skype from the site perform
dpkg -i skype
Most likely, there will be a message about unresolved dependencies with a list of packages.
I need it through the search engine.
Find these packages on debian.org download and run again dpkg -i There may be new unauthorised
dependency, so the process can be delayed, but sometimes it works.
When updating the package manager, i.e. after commands
apt-get update
There might be a mistake.
W: GPG error: http://dl.google.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991
You can add publickey in the following way:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A040830F7FAC5991
If there is an error
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
So another package manager is running, for example. synaptic. We need to close it.
Installing Java
Java is everywhere. For example, without java will not be installed. SOAP UI
apt-get install default-jre
Detailed instructions, not the fact that it will work immediately.
Possible errors in installation
Java
You can find in the article
Errors
Start of work
After installation, the system should restart. Responsible for loading
Grub2
It is worth reading about separately. But if everything works with it, you can postpone it.
After rebooting, you get into the so-called shell.
The most popular shell is
bash
You need to learn the basic commands cd, ls, mkdir, mount … this can be done in the article
«Basics of bash»
In textbooks and manuals there is a rule: if command is #, then it is from root if @ then from a simple user.
I'm starting to think it's set to a minimum, and you see a black screen that says something like,
root@Name:~#
Run command.
cd /
Press Enter and write.
ls
You will see a list of folders that lie in the root directory. The root folder is designated as
/
If the setup was from a netinstall image, then Debian is almost naked. You need to add various additions from the Internet.
So-called packages and programs.
A possible problem at this stage is the lack of internet. For example, in the installation there is a risk.
Specify the wrong network interface choice between
eth0 and eth1
We can adjust.
/etc/network/interfaces
Read more in the article
«Configure the network in Debian»
Example
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.107
netmask 255.255.255.0
gateway 192.168.0.1
After editing, update the network connection
/etc/init.d/networking restart
If it does not help, try to download another network card eth1 instead of eth0.
If the internet is working, I recommend doing it first.
aptitude update
aptitude upgrade
Same thing with apt-get. In theory, this should help update package managers. I'm like a shaman with tambourines.
It's regular. When upgrading the entire system, you will need to choose languages again and so on.
To find out the kernel version you need to dial
uname -a
My core debian 2.6.32-5 was exactly what needed to be updated.
Just in case, I recommend adding to
/etc/apt/source.list
deb http://ftp.ru.debian.org/debian/ squeeze main contrib non-free
deb http://ftp.ru.debian.org/debian/ testing main contrib non-free
You may need to use Midnight Commander.
apt-get install mc
And archivists.
apt-get install zip unzip p7zip bzip2
You can try to make Russian in the console (if not)
apt-get install console-cyrillic console-terminus
If the computer freezes. To reboot, you can use a combination of keys
Press Alt + PrtScr sequentially
R E I S U B
The Debian sound is in charge alsamixer
aptitude install alsa-utils alsa-base alsa-tools
Something has to jump in.
Enter command.
alsamixer
There'll be a few poles. Sometimes problems with sound are solved by increasing the height of the columns (arrows up). Sometimes you need to replace the zeroes under the columns with the letters M and vice versa.
Graphic shell
Installation of a graphic shell (ix) on the example gdm3:
apt-get install gdm3
When starting the graphical interface, you can select the shell using the key
F1
Get into the graphic shell (ix) for the first time:
startx
Select "Use the default settings"
Back to the console:
Ctrl + Alt + F1
Get out of the console to X:
Alt + F7
You can restart X-server with command.
/etc/init.d/ gdm3 restart
Shutting down the Xes
/etc/init.d/ gdm3 stop
Enable the X server
/etc/init.d/ gdm3 start
Installation of useful programs for the ordinary user:
browser iceweasel. Preliminary advice to register in
/etc/apt/sources.list
line
deb http://mozilla.debian.net/ squeeze-backports iceweasel-release
The browser itself:
apt-get install iceweasel
ktorrent is usually in the archive .tar.bz2, it is unpacked using:
tar -xvjf
When you have a file with .deb extension
dpkg -i
apt-get install ktorrent
When installing a message from the developers can get out - press q
Another thing that comes as a complete surprise to beginners is
The need for so-called disk mounting.
In Windows Usually all disks are visible immediately (keyword - usually). In order to gain access to all Logical disks, with the exception of the system, must indicate to the system Which folder should this disk be attached to? I mean, write (under root)
fdisk -l
A list of your drives will appear, and if you know what you want to use, you need something similar to
mount /dev/sda5 /mnt/w7free
So I attach the disc. sda5 filesystem
NTFS
(Remind me that he went under number 3 in the list above)
This process is described in detail here
To process images and take screenshots, you need to install a program
Gimp
apt-get install the gimp
Another possible problem is incorrect timing. You can change the time zone with commands.
dpkg-reconfigure tzdata
Setting time and date
The time zone under Debian is established through a symbolic link.
File.
/etc/localtime
should look at the time zone setting file in the directory
/usr/share/zoneinfo
It tells you what time zone you are in.
For example: I live in Russia (Moscow time) I have to make a link
/etc/localtime
file /usr/lib/zoneinfo/Europe/Moscow
That requires command:
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
To find out what time zones are available, check them in the directory.
/usr/share/zoneinfo:
cd /usr/share/zoneinfo
ls
Choose the most suitable one for you...
If the time is not set right, then you have the wrong time in the BIOS.
To check the time in the BIOS, use command:
hwclock
2021-09-08 11:25:17.289911+02:00
Now we know what time is set in the BIOS, but we need to fix it. Adjust time in the system:
date MMDDhhmmCCYY.ss
Description of commands date parameters:
MM – two digits of the current month (example: January=01);
DD two digits of the current date (if the current calendar day 1, then 01 is written);
hh - two digits indicating the hour;
mm Two digits indicating minutes;
CCYY - four digits of the year;
ss is two digits of seconds.
You can also enter «date MMDDhhmmCCYY»
without seconds, then the seconds are set to zero.
And now we introduce a new set time in BIOS:
hwclock --systohc
Archives
Example: Add all .jpg files from the directory to the archive
tar czf archive.tar.gz *.jpg
tar.gz
tar xvzf archive_name.tar.gz
tar.bz2
tar xvjf archive_name.tar.bz2
To unpack the archive into a specific directory, use the option -C or option --directory
tar -xf archive.tar -C /target/directory
tar -xf archive.tar.gz --directory /target/directory
rar
Set up unrar,
apt-get install unrar
later
unrar archive_name.rar
zip
Set unzip,
apt-get install unzip
later
unzip archive_name.zip
If these methods do not help, you can try p7zip. You can put peazip under the X. As a last resort, you can Use online archives, for example wobzip
Recoding
Suppose you have a file.
file
in the wrong coding.
You can change the encoding of files in the following way:
cat file.html | iconv -f cp1251 -t utf-8 > new.html
One way. Then we open, edit, close.
cat new.html | iconv -f utf-8 -t cp1251 > file.html
As an option, you can use convmv
If you have problems with coding on the site I recommend reading the article. «Site in incorrect encoding»
Set up xfce4
To make life a little more fun, you can do a couple of manipulations with the panel. Let's go.
Settings → Panel → Elements
And we add what we need. You can change the clock to a clock with a date. Add the volume control.
To add the battery level for the laptop and the applet of the keyboard layout, you need to download the applet from the repository:
apt-get install xfce4-battery-plugin
apt-get install xfce4-xkb-plugin
To enlarge the font in the xfce4 terminal emulator, you need to press Ctrl and hold it to make a right click.
Mouses on the terminal will appear intuitive menu.
Restart.
X-server
(Previously leaving for the console Ctrl + Atl + F1) can command
/etc/init.d/gdm restart
or
/etc/init.d/gdm3 restart
or
/etc/init.d/kdm restart
To turn off, you need to write not restart but stop, to start start
keyboard
The layout and other keyboard settings are in the file
/etc/default/keyboard
Instructions for adding language
here
Users
To create a user1 you need to enter command.
adduser user1
If you have received a message bash: adduser: command not found read the decision here
If this user is bored, you can delete command.
deluser user1
If you forget the user password, you can change command from the root.
passwd user1
The list of users is in the file /etc/passwd to open it enter
cat /etc/passwd
Find out what groups the user 1 is in
groups user1
Add user1 to the group group1
usermod -G group1 user1
Add a sinij user to both group1 and bks fans
usermod -G group1,bks_fans sinij
Modify the main user group 1 to group 2 (By default, the group is usually called the same as the user.)
usermod -g group2 user1
Get a list of all groups
cat /etc/group
To get not the entire list, but only regular user groups
cat /etc/group | grep 1[0-9][0-9][0-9]
You can read about Grep and other commands.
here
Change the group to which the directory belongs
/home/movies on users
chgrp -R users /home/movies
SSH connection
A protocol connection can be used to exchange information with other computers.
ssh. Suppose you want to connect from a laptop to a stationary PC.
You need to create a new user on your PC, let’s call it a sinij.
adduser sinij
We create a more complex password, for example.
QWERTY 9dkjvA!#4jdLs
Now you need to install ssh on both computers - if it is not already available
apt-get install ssh
Check if ssh is working.
service ssh status
Stop / start / restart ssh
/etc/init.d/ssh stop
/etc/init.d/ssh start
/etc/init.d/ssh restart
Find out ip stationary PC (ip PC) using
ifconfig
If ifconfig fail out
ifconfig command not found debian
You can take advantage of command.
ip addresses
Or install ifconfig.
To connect to a PC on a laptop, enter into the terminal
ssh sinij@pc_ip
If you can connect, you can start to move to the folders of the remote PC.
To disconnect from the connection, you need to type something from the list:
exit
logout
ctrl + D
To make changes to the connection settings, you need to edit the file
/etc/ssh/sshd_config
- on the server and
/etc/ssh/ssh_config
- on the client.
In the file
/etc/ssh/sshd_config
Change the default port to any free port
#Port 22
Port 2222
You can log in with a password if the line in /etc/ssh/sshd_config is uncommented
PasswordAuthentication yes
This is a less secure method than login by key, so usually instead of
yes point out no
Edit the file
/home/username/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
alias ll='ls -laF'
alias ec='nano /root/.bashrc'
alias es='nano /etc/ssh/sshd_config'
alias eg='nano /etc/group'
alias ep='nano /etc/passwd'
alias ea='nano /var/log/auth.log'
alias ps='ps -ax|grep ss'
alias ss='/usr/sbin/ssh'
Wi-fi
You can try it first.
apt-get install wireless-tools
For xfce4 suitable wicd
apt-get install wicd
Once the Wicd is installed, it should appear among the menu items.
The Internet. If it does not appear, you need to restart the X. Maybe we should.
reboot
A connection icon should appear in the corner of the screen. If there are multiple badges,
So there's something else, like network-manager-gnome.
You can do it just in case.
apt-get remove network-manager-gnome
And then
reboot
One of the badges must go missing. Put the cursor on the second.
I choose "Connect." - No wireless networks found.
On the advice of lor, I wrote in the field.
Wireless interface value is wlan0. Networks should come.
wicd apt-get remove wicd
apt-get autoremove
apt-get remove network-manager
apt-get autoremove
reboot
Then reset it.
Iron
Get information about iron
dmesg
Get information about CPU
cat /proc/cpuinfo
or
dmesg | grep CPU
Find out the level. RAM
dmesg | grep "RAM width"
Find out the size of RAM
tac /proc/meminfo | grep MemTotal
List of devices PCI tire
lspci -k
Get a list of mounted disks and their size can be command df
df -ht ext4
Filesystem Size Used Avail Use% Mounted on /dev/sda2 454G 3.6G 427G 1% /
Flag h - volume in human-readable form
t ext4 - show only disks with ext4 file system
Disc mounting
Preparation
You need to create a folder to which the disk is mounted. For example, for a disk. /mnt/w7free
mkdir /mnt/w7free
Or a flash drive.
mkdir /mnt/flashcard
Step 1.
Before mounting the disk, you first need to understand which disks are connected to the computer.
There are several ways to do this: lsblk, ls/dev/sd*, fdisk-l, and others.
Get a list of all devices, including unmounted
lsblk | grep sd
sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 461.4G 0 part / └─sda3 8:3 0 3.9G 0 part [SWAP] sdb 8:0 0 100.0G 0 disk └─sdb1 8:1 0 512M 0 part /home
There are also discs.
NVM (non-volatile memory)
It starts with nvm.
You’ll have to watch another command, or take it.
df
lsblk | grep nvm
nvme0n1 259:0 0 477G 0 disk ├─nvme0n1p1 259:1 0 512M 0 part /boot/efi ├─nvme0n1p2 259:2 0 976.6M 0 part /boot └─nvme0n1p3 259:3 0 475.5G 0 part └─nvme0n1p3_crypt 253:0 0 475.5G 0 crypt /
Real physical disks get letters a.
b and so on. That is, sda This is the first disc, sdb the second and so on.
Virtual partitions get numbers. The sda disc is divided into three parts and the sdb consists entirely of sdb1.
The next two things I did on another computer.
The second way is ls/dev/sd* and ls/dev/nvm*
ls /dev/sd*
/dev/sda /dev/sda2 /dev/sda5 /dev/sdb1 /dev/sdb5 /dev/sdb7
/dev/sda1 /dev/sda3 /dev/sdb /dev/sdb2 /dev/sdb6 /dev/sdb8
And for NVM discs.
ls /dev/nvm*
/dev/nvme0 /dev/nvme0n1 /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3
The third method is fdisk -l, you may need to enter sudo fdisk -l.
debian:/home/andrey# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x63e54f64
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 100558847 50176000 7 HPFS/NTFS/exFAT
/dev/sda3 100558848 1953521663 926481408 f W95 Ext'd (LBA)
/dev/sda5 100560896 1953521663 926480384 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbbc1fe9a
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 41785064 20892501 83 Linux
/dev/sdb2 41785126 976768064 467491469+ f W95 Ext'd (LBA)
/dev/sdb5 41785128 54283634 6249253+ 82 Linux swap / Solaris
/dev/sdb6 54283698 521887589 233801946 83 Linux
/dev/sdb7 521887653 585826289 31969318+ b W95 FAT32
/dev/sdb8 585826353 976768064 195470856 7 HPFS/NTFS/exFAT
From this data we can conclude that physically hard drives can be seen two: sda and sdb, one of them at 1 TB and the other.
500GB. Assume that you need to mount the disk sda5 - you can
step 2
Step 2 (for flash card)
Physical installation of the flash drive in the USB port.
Step 3 (for flash card)
We use command again.
ls /dev/sd*
or
fdisk -l
Everything new compared to the previous time is your flash drive. If, for example, it appears, sdb and sdb1then sdb It is a flash drive in general (I don’t know how to understand it) sdb1 - Usually there is a section that will need to be mounted.
Step 4
Image mounting.
The very word “mounting” can confuse a novice user. The point of all manipulation is
Show the system how to link a visible disk to a folder.
mount /dev/sda5 /mnt/w7free
For a flash card.
Suppose that the new disc we found in Step 3 is called
cdc1
mount /dev/sdc1 /mnt/flashcard
If you need to specify the file system, then write, for example.
mount -t vfat /dev/sdb /mnt/flashcard
where vfat This is an indication of the file system (fat), -t It's from type type.
Automatic mounting during loading
In order not to mount disks every time manually you can write this process into a file.
/etc/fstab
First you need to know the permanent number of the disk you want to mount.
ls -l /dev/disk/by-uuid
andrey@debian:~$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Apr 1 12:26 28F45727F456F712 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 1 12:26 2ff64169-2a42-4134-bb7d-785d2cb7ac26 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Apr 1 12:26 3AE8F3DBE8F3937D -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr 1 12:26 3E8904579F5AA793 -> ../../sda5
lrwxrwxrwx 1 root root 10 Apr 1 12:26 BB76478F1B670CB0 -> ../../sdb8
lrwxrwxrwx 1 root root 10 Apr 1 12:26 DEFB-25FE -> ../../sdb7
lrwxrwxrwx 1 root root 10 Apr 1 12:26 e7b2f181-26ae-4a22-9c9a-10a6dc22daee -> ../../sdb5
lrwxrwxrwx 1 root root 10 Apr 1 12:26 eafb05d0-15c7-41a5-9709-318bb2c618b7 -> ../../sdb6
3E8904579F5AA793 is the sda5 disk number you need to mount.
Open /etc/fstab
nano /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda1 during installation
UUID=2ff64169-2a42-4134-bb7d-785d2cb7ac26 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID=eafb05d0-15c7-41a5-9709-318bb2c618b7 /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
UUID=e7b2f181-26ae-4a22-9c9a-10a6dc22daee none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
And we write down the lines.
#win7 disk NTFS - this is a comment to make navigation easier.
UUID=3E8904579F5AA793 /mnt/w7free ntfs defaults,cp1251,umask=000 0 0
Mounting with access rights
If the task is to make the mountable disk available, for example, only to the user andrey User ID with 1000 and group admins id of group 1111 . and the file access conditions you want to specify are not 777 a, for example 770
mount -t ntfs -o rw, uid=1000, gid=1111, fmask=0007, dmask=0117 /dev/sda5 /mnt/w7free/
where fmask This is the number that is subtracted from 777 to access files, and dmask is like fmask.
dmask
for directories.
References
Linux mount
Go to the site on ftp
mc
Midnight Commander will launch
F9
Find FTP in the top menu. The address is written as follows:
login:password@hostname
In the graphics shell, you can install for example filezilla.
How to Create a File in Linux
cat > filename.filenameextension
Structure
Programme programmes
/usr/bin
Documentation.
/usr/share/doc
Configuration files
/etc
| File. | Description |
|---|---|
| /etc/aliases |
Postal aliases database.
File format: alias user The system does not use this file. /etc/aliases.db which is created by the program newaliases on the contents of the file /etc/aliases. After updating /etc/aliases needle to perform # newaliases |
| /etc/hosts.conf |
Contains parameters of domain name resolution.
For example, direct order hosts
, bind means that first the IP address search by domain name will be done in the file
/etc/hosts
.
And then there will be a call to the DNS server specified in the file.
/etc/resolv.conf
The multi-on directive means that multiple IP addresses can correspond to a single domain name. |
| /etc/hosts | In this file, you can write IP addresses and names of local network nodes , but usually only the IP address of the localhost node (127.0.0.1) is indicated here, because now even the A small local area network has its own DNS server installed. |
| /etc/hosts.allow | Contains IP addresses of nodes that are allowed to access the services of this node |
| /etc/hosts.deny | IP addresses of nodes that are prohibited from accessing the services of this node |
| /etc/iftab | Table of interfaces, i.e. correspondence of interface names and their MAC addresses |
| /etc/motd | Message of the day (message of the day) This file is used by many network services (for example, FTP and SSH-services), which, when registering a user, can output a message from this file |
| /etc/resolv.conf |
Specifies IP addresses of DNS servers. The file format is simple: nameserver IP address There are four DNS servers in total. |
| /etc/services | Service database that matches the symbolic name service (e.g., pop3) and port number (110/tcp, tcp is the name of the protocol) |
| /etc/xinetd.conf | xinetd superserver configuration designed to run Network services that do not work offline |
# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: andrey
Updating the distribution
Execute commands by tracking errors:
aptitude -f install
aptitude update
aptitude install apt aptitude dpkg
aptitude dist-upgrade
aptitude full-upgrade
Recording a bootable usb disk
dd if=/home/andreyolegovichru/Downloads/image.iso of=/dev/sdb1 bs=1M
where after if= Write the way to the image, for example.
/home/andrei/Downloads/debian-7.1.0-amd64-DVD-1.iso and
/dev/sbd1 - it's your usb drive.
You can determine the path to the usb disk as follows: pull the usb disk, make command:
fdisk -l
Then insert the USB drive and execute this command again. There will be a couple of new ones. lines, that's it. your CD. When using dd It is necessary to specify the general part of these two lines, i.e. if sdb and sbd1 leave sbd.
| keyboard | The result |
|---|---|
| LEFT | - 10 seconds ago. |
| Right. | - 10 seconds forward. |
| Up. | - 60 seconds forward. |
| Down. | - 60 seconds ago. |
| 9 | - Turn down the volume. |
| 0 | - Turn up the volume. |
| { | - Reduce the speed of reproduction |
| } | - Increase the speed of reproduction |
| SPACE (space) | - Pause. |
| F | - Full screen. |
The first problem you may have is a fake fullscreen. The picture remains small and everything is free. It's a black background. I was helped by launching mplayer with a key.
-vo sdl
If you need to watch the video in the original language, and even with subtitles (in our time you can download and not so) You will need some information about the video file. So the first thing we do is find out which tracks our video supports:
mplayer -vo null -ao null -frames 0 -v file_name | grep aid mplayer -vo null -ao null -frames 0 -v file_name | grep sid
After finding out the possible ligaments, and there are 2 of them, we use them, and to be exact, one of them. To begin with, the 1st in which we specify -aid (ID audio) -sid (ID subtitles):
mplayer -aid 1 -sid 1 file_name
or 2nd in which we specify directly -alang (audio language) or -slang (subtitle language):
mplayer -alang eng -slang eng file_name
Shell (Command Shell)
List of available shells
cat /etc/shells
Identify the currently active shell
echo $SHELL
Shift.
chsh
or
# usermod -s /bin/bash username
If after changing the shell there are problems, for example, do not go under the root. We can load in. recovery mod do # usermod -s /bin/bash root and # usermod -s /bin/bash username
Teams for working with text files
Team head
You can take advantage of command.
head If you only need to look at the beginning of the file. The team looks like this:
head <filename>
Team. Head It may be useful, but since it only shows the first few lines, You won’t know how big the file is. By default, you can view The first ten lines of the file, although you can change this number by executing the following command:
head -20 <filename>
Team tail
Reverse. head perform tail . With help. tail You can view the last ten lines of the file.
Team. grep
The grep command is used to search the file for specified text strings.
For example, if you want to find all mentions of the word "DEBUG" in the file
reader.iniDo this.
grep DEBUG reader.ini
You will see all the lines of this file in which the word "DEBUG" was found.
Don't forget the register.
Unless otherwise indicated, grep seek register-based. That means searching Debug different debug. Among the many parameters grep eat -i. which indicates that the search must be performed without regard to the register of symbols. Read the man's page by grep To find out more about this command.
Redirection of input/output and channels
You can use channels and redirect output whenever you want to save and/or print information for later use.
For example, you can use command. grep find the required text in the file and then save the result in file or send it to the printer.
To publish information, for example concerning words "Debug" in the file sneakers.txtenter:
grep Debug sneakers.txt | lpr
Substitution signs and regular expressions
What if you forget the file name you need? Using substitution signs or regular expressions, you can perform actions with the file or files without knowing its full name. Just enter everything you know and replace the rest with the * sign.
Additional information on substitution marks and regular expressions
To learn more about substitution signs and regular expressions, refer to the guide page bash (man bash). Remember that you can save the received information in a text file, command
man bash | col -b > bash.txt
You can then open and read the file using
less or pico (pico bash.txt)
If you want to print a file, be careful, it is quite large.
Knowing that the file is called "sneak .txt," just type:
ls sneak*.txt
And here's the full file name:
sneakers.txt
Most likely, when searching, you will use the multiplication sign more often. *). When searching with this sign, you will find everything that corresponds to a given pattern. Even after:
ls *.txt
or:
ls sn*
You'll find the file. sneakers.txt And all the others whose names begin. c "sn" This allows you to expand the search area as much as possible.
One way to reduce the search area is to use a question mark. ??). Like a multiplication sign, ? It helps to find a file that satisfies the search condition.
However, ? It is used to replace just one character, so if you are looking for it, sneaker?.txtAs a result, you will find the file. sneakers.txtand/or sneakerz.txtIf such a file exists.
If the multiplication sign is included in the file name, how could it be if the file sneakers.txt would be sneak*.txt. You will need regular expressions.
Regular expressions are more complex than straightforward question and multiplication signs.
By means of the backward slash (\) You can determine what you don’t want to look for. everything What happens if you give a multiplication sign, and you need it? Multiplication sign in the file name.
If the file is called sneak*.txtenter:
sneak\*.txt
Below is a short list of substitution signs and regular expressions:
- * — Matches any number of any characters
- ? — Matches any single character in the line (for example, sneaker?.txt)
- \* — Corresponds to the * character
- \? — Corresponds to the ? character
- \) — Corresponds to the ) character
Completion of work
# halt
# poweroff
# shutdown
# shutdown 18:00
# shutdown -h now
Resetting
reboot
reboot -f (forced)
Article author: Andrei Olegovich