Debian using

Last modified: 2018-09-28 06:06Z

Страница требует косметической правки


Settings:


   sources.list FREE

root# nano /etc/apt/sources.list


deb http://deb.debian.org/debian stretch main deb-src http://deb.debian.org/debian stretch main

deb http://deb.debian.org/debian/ stretch-updates main deb-src http://deb.debian.org/debian/ stretch-updates main

deb http://security.debian.org/debian-security stretch/updates main deb-src http://security.debian.org/debian-security stretch/updates main


root# aptitude update



   sources.list NON-FREE

root# nano /etc/apt/sources.list


deb http://deb.debian.org/debian stretch main contrib non-free deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian/ stretch-updates main contrib non-free deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free

deb http://security.debian.org/debian-security stretch/updates main contrib non-free deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free


root# aptitude update



   sources.list using tor with apt

root# aptitude install tor apt-transport-tor root# nano /etc/apt/sources.list


deb tor+http://vwakviie2ienjx6t.onion/debian stretch main deb-src tor+http://vwakviie2ienjx6t.onion/debian stretch main

deb tor+http://sgvtcaew4bxjd7ln.onion/debian-security stretch/updates main deb-src tor+http://sgvtcaew4bxjd7ln.onion/debian-security stretch/updates main

deb tor+http://vwakviie2ienjx6t.onion/debian stretch-updates main deb-src tor+http://vwakviie2ienjx6t.onion/debian stretch-updates main


root# aptitude update



   sources.list Offline

Create folders for mount iso images: root# mkdir -p /media/offlinerepo1 root# mkdir -p /media/offlinerepo2 root# mkdir -p /media/offlinerepo3

Mount iso images: root# mount -o loop /folder/folder/debian-8.0.0-amd64-DVD-1.iso /media/offlinerepo1/ root# mount -o loop /folder/folder/debian-8.0.0-amd64-DVD-2.iso /media/offlinerepo2/ root# mount -o loop /folder/folder/debian-8.0.0-amd64-DVD-3.iso /media/offlinerepo3/

Offline iso repository: root# nano /etc/apt/sources.list


deb file:///media/offlinerepo1/ jessie main contrib deb file:///media/offlinerepo2/ jessie main contrib deb file:///media/offlinerepo3/ jessie main contrib


root# aptitude update



   sources.list Add CD/DVD Debian

Insert CD/DVD to CD-rom root# apt-cdrom add



   GRUB2 Native

root# nano /etc/default/grub


  1. If you change this file, run 'update-grub' afterwards to update
  2. /boot/grub/grub.cfg.
  3. For full documentation of the options in this file, see:
  4. info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0 GRUB_TIMEOUT=15 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet" GRUB_CMDLINE_LINUX=""

  1. Uncomment to enable BadRAM filtering, modify to suit your needs
  2. This works with Linux (no patch required) and with any kernel that obtains
  3. the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
  4. GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
  1. Uncomment to disable graphical terminal (grub-pc only)
  2. GRUB_TERMINAL=console
  1. The resolution used on graphical terminal
  2. note that you can use only modes which your graphic card supports via VBE
  3. you can see them in real GRUB with the command `vbeinfo'
  4. GRUB_GFXMODE=
  5. GRUB_GFXPAYLOAD_LINUX=keep
  6. GRUB_BACKGROUND=""
  1. Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
  2. GRUB_DISABLE_LINUX_UUID=true
  1. Uncomment to disable generation of recovery mode menu entries
  2. GRUB_DISABLE_RECOVERY="true"
  1. Uncomment to get a beep at grub start
  2. GRUB_INIT_TUNE="480 440 1"

root# update-grub



   GRUB2 Black CLI FullHD

root# nano /etc/default/grub


  1. If you change this file, run 'update-grub' afterwards to update
  2. /boot/grub/grub.cfg.
  3. For full documentation of the options in this file, see:
  4. info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet" GRUB_CMDLINE_LINUX=""

  1. Uncomment to enable BadRAM filtering, modify to suit your needs
  2. This works with Linux (no patch required) and with any kernel that obtains
  3. the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
  4. GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
  1. Uncomment to disable graphical terminal (grub-pc only)
  2. GRUB_TERMINAL=console
  1. The resolution used on graphical terminal
  2. note that you can use only modes which your graphic card supports via VBE
  3. you can see them in real GRUB with the command `vbeinfo'

GRUB_GFXMODE=1920x1080 GRUB_GFXPAYLOAD_LINUX=keep GRUB_BACKGROUND="/usr/share/images/grub2_FHD.png"

  1. Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
  2. GRUB_DISABLE_LINUX_UUID=true
  1. Uncomment to disable generation of recovery mode menu entries
  2. GRUB_DISABLE_RECOVERY="true"
  1. Uncomment to get a beep at grub start
  2. GRUB_INIT_TUNE="480 440 1"

Background for grub2

root# cp '/folder/grub2_FHD.png' '/usr/share/images/grub2_FHD.png'

root# update-grub


   fstab
  1. root# blkid
  2. root nano/etc/fstab

  1. /etc/fstab: static file system information.
  2. Use 'blkid' to print the universally unique identifier for a
  3. device; this may be used with UUID= as a more robust way to name devices
  4. that works even if disks are added and removed. See fstab(5).
  5. file system mount point type options dump pass
  6. / was on /dev/sda1 during installation

UUID=57abf947-bc56-4c48-8380-2cc2bddcf542 / ext4 errors=remount-ro 0 1

  1. /home was on /dev/sda6 during installation

UUID=6d2f4902-c251-4dd1-9bb9-8c31cbef8074 /home ext4 defaults 0 2

  1. swap was on /dev/sda5 during installation

UUID=e155cec4-cf4b-4b84-bf38-b25a017b142d none swap sw 0 0 /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0

  1. NTFS Windows 7 partition

UUID=1F72B6883E2E1FAB /mnt/Windows ntfs-3g noauto 0 0


file systems - defines the storage device (i.e. /dev/sda1).

dir - tells the mount command where it should mount the file system to.

type - defines the file system type of the device or partition to be mounted. Many different file systems are supported. Some examples are: ext2, ext3, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swap, and auto. The 'auto' type lets the mount command to attempt to guess what type of file system is used, this is useful for removable devices such as CDs and DVDs.

options - define particular options for filesystems. Some options relate only to the filesystem itself. Some of the more common options are:

auto - file system will mount automatically at boot, or when the command 'mount -a' is issued.

noauto - the filesystem is mounted only when you tell it to.

exec - allow the execution binaries that are on that partition (default).

noexec - do not allow binaries to be executed on the filesystem.

ro - mount the filesystem read only.

rw - mount the filesystem read-write.

sync - I/O should be done synchronously.

async - I/O should be done asynchronously.

flush - specific option for FAT to flush data more often, thus making copy dialogs or progress bars to stays up until things are on the disk.

user - permit any user to mount the filesystem (implies noexec,nosuid,nodev unless overridden).

nouser - only allow root to mount the filesystem (default).

defaults - default mount settings (equivalent to rw,suid,dev,exec,auto,nouser,async).

suid - allow the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.

nosuid - block the operation of suid, and sgid bits.

noatime - do not update inode access times on the filesystem. Can help performance.

nodiratime - do not update directory inode access times on the filesystem. Can help performance.

relatime - update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time (similar to noatime, but doesn't break mutt or other applications that need to know if a file has been read since the last time it was modified). Can help performance.

dump - is used by the dump utility to decide when to make a backup. When installed, dump checks the entry and uses the number to decide if a file system should be backed up. Possible entries are 0 and 1. If 0, dump will ignore the file system, if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the "dump" entry.

pass fsck reads the "pass" number and determines in which order the file systems should be checked. Possible entries are 0, 1, and 2. The root file system should have the highest priority, 1, all other file systems you want to have checked should get a 2. File systems with a "pass" value 0 will not be checked by the fsck utility.



   Keyboard CLI

root# nano /etc/default/keyboard


  1. KEYBOARD CONFIGURATION FILE
  1. Consult the keyboard(5) manual page.

XKBMODEL="pc105" XKBLAYOUT="us,ru" XKBVARIANT="" XKBOPTIONS="grp:alt_shift_toggle"

BACKSPACE="guess"




   Display Manager

root# nano /etc/X11/default-display-manager

CLI (startx): (If startx don't work: root# aptitude install xinit)


/usr/sbin/



GNOME:


/usr/sbin/gdm



KDE: (kdm discontinued)


/usr/lib/kde4/bin/sdm




   Date/Time

root# date +%T -s "15:37:00" root# date root# hwclock --show root# hwclock --set --date="2017-06-14 15:39:00" --localtime



   SWAP local file

count = 8192k - 8GB-swap

root# dd if=/dev/zero of=/swap bs=1024 count=8192k root# chmod 600 /swap root# mkswap /swap root# swapon /swap root# blkid root# nano /etc/fstab



   Bluetooth

for GNOME root# aptitude install gnome-bluetooth

for KDE root# aptitude install bluedevil

Gtk2 root# aptitude install blueman





   Applications:


   Shutdown

Print a manual user$ man shutdown

Print a short help text and exit user$ shutdown --help

Reboot the machine now root# shutdown -r now

Do not halt, power-off, reboot, just write wall message root# shutdown -k

Do not send wall message before halt, power-off, reboot root# shutdown --no-wall

Normal shutdown now root# shutdown -h now

Shutdown after 70 minutes root# shutdown -h +70

Shutdown at 23:25 root# shutdown -h 23:25

Cancel a pending shutdown. That is not "+0" or "now" root# shutdown -c



   Finger scanner

root# aptitude install fprintd fprintd-doc libpam-fprintd libfprint0

Delete user's finger root# fprintd-delete user

Enroll user's finger root# fprintd-enroll -f finger user

Show user's finger list root# fprintd-list user

Verify user's finger root# fprintd-verify -f finger user

Fingers: left-thumb

           left-index-finger
           left-middle-finger
           left-ring-finger
           left-little-finger
           right-thumb
           right-index-finger
           right-middle-finger
           right-ring-finger
           right-little-finger

Simple GTK+ application for testing libfprint's functions root# aptitude install fprint-demo



   Mount ISO disk

root# mount /folder/image.iso -o loop /mnt/cdrom

FDD: DCF, DMS, IMA/IMZ, IMG, VFD, ADF/ADZ; HDD: VHD, VMDK, Qcow2, GHO/GHS, PQI, VDF, Windows Imaging Format, DMG; CD/DVD: ISO, .nrg, .mdf, .uif; Info: CUE, .mds, .ccd;



   Network statistic

user$ vnstat -i wlp2s0 -l

  1. root vnstat -u -i enp6s0
  2. root vnstat -u -i wlp2s0

user$ vnstat eth0 is native user$ vnstat -q

Statistic real time user$ vnstat -l

vnstat help user$ vnstat --help or user$ vnstat --longhelp

Cron /usr/share/doc/vnstat/examples/vnstat.cron

Systemd

  1. root systemctl start vnstat.service

/etc/vnstat.conf.



   Scalpel

user$ nano /etc/scalpel/scalpel.conf root# scalpel /dev/sd3 -o /home/user/folder/ or root# scalpel /folder/image.iso



   Foremost

user$ nano /usr/local/etc/foremost.conf root# foremost -t pdf,jpg -T -v -Q -o /home/user/folder /dev/sdb



   sdcv

user$ cp /folder/dictionary.xxx /home/user/.stardict/ user$ sdcv --data-dir=/home/user/.stardict/



   Netstat statistic open ports

user$ netstat -ltupn

user$ netstat -lantp | grep ESTABLISHED |awk '{print $5}' | awk -F: '{print $1}' | sort -u

list all opening TCP user$ netstat -at

list all opening UDP user$ netstat -au

list only listening TCP user$ netstat -lt

statistic all ports user$ netstat -s

PID user$ netstat -p

user$ netstat -ltupn

list connected hosts user$ netstat -lantp | grep ESTABLISHED |awk '{print $5}' | awk -F: '{print $1}' | sort -u



   ss

user$ ss -p user$ ss -l user$ ss -o state established '( dport = :www or sport = :www )'



   lsof

user$ lsof -i user$ lsof -i :80



   dd
  1. root if=/dev/zero of=/path/filename bs=1024 count=size
  2. root chmod 600 /path/filename
  3. root mkswap /path/filename
  4. root swapon /path/filename

copy disk

  1. root dd if=/dev/old_disk of=/dev/new_disk conv=noerror,sync

copy disk to image file

  1. root dd if=/dev/old_disk of=image_file conv=noerror
  1. root ddrescue -n /dev/old_disk /dev/new_disk rescued.log
  2. root ddrescue -r 1 /dev/old_disk /dev/new_disk rescued.log



   p7zip

user$ zip fileout.zip filein.txt user$ zip fileout.zip filein.txt filein.mp3 filein.doc user$ zip -r folderout.zip folderin user$ zip -P password -r folderout.zip folderin user$ zip -er folderout.zip folderin ...

... - hiden password

user$ unzip filein.zip user$ unzip filein.zip -d /folder/user/



   wget

Download web site user$ wget -r -k -l 7 -p -E -nc http://site.com/



   xterm

user$ xterm -geometry 93x31+100+350





   Media:


   Audio

Info audio: user$ pacmd list-sources | grep -e 'index:' -e 'name:' -e device.string


index: 0

   name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
           device.string = "0"
  • index: 1
   name: alsa_input.pci-0000_00_1b.0.analog-stereo
           device.string = "front:0"


index = -i

Record audio microphone: user$ ffmpeg -f pulse -ac 2 -i 0 '/folder/audioout.wav'

Record audio desktop: user$ ffmpeg -f pulse -ac 2 -i 1 '/folder/audioout.wav'


Test speakers: user$ speaker-test -c 2 -f 48000 -F S32_BE -t pink -l 2 -X



   Video
   Record:


Record display FullHD 30fps speed: user$ ffmpeg -video_size 19200x1080 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 15 -preset ultrafast -c:a opus '/folder/videoout.mkv'

Record display lossless FullHD 60fps quality: user$ ffmpeg -video_size 19200x1080 -framerate 60 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset veryslow -c:a pcm_s16le -ac 2 -ar 48000 '/folder/videoout.mkv'

Record webcam video: user$ ffmpeg -f v4l2 -r 30 -s 640x480 -i /dev/video0 -f pulse -ac 2 -i 0 /folder/videoout.mkv



   Convert:


DVD Remux BUT better using mkvtoolnix: user$ ffmpeg -i /folder/videoin.vob -c:v copy -c:a copy '/folder/videoout.mkv'

BluRay Remux BUT better using mkvtoolnix: user$ ffmpeg -i '/folder/videoin.m2ts' -c:v copy -c:a copy '/folder/videoout.mkv

(Cut from 01:19:00; Duration 5 min 10 sec): user$ ffmpeg -ss 01:19:00 -t 00:05:10 -i '/folder/videoin.xxx' '/folder/videoout.mkv'

DVD Rip: user$ ffmpeg -i '/folder/videoin.vob' -c:v libtheora -q:v 10 -c:a opus -ac 6 '/folder/videoout.mkv'

BluRay Rip: $ ffmpeg -i '/folder/videoin.m2ts' -c:v libx264 -preset veryslow -crf 0 -c:a flac '/folder/videoout.mkv

(image1.jpg, image2.jpg ...): user$ ffmpeg -f image2 -i image%d.jpg video.mpg

12fps; image_%010d.png = (image_0000000001.png, image_0000000002.png ...): user$ ffmpeg -r 12 -y -i "image_%010d.png" videoout.mpg

Video to images: user$ ffmpeg -i video.mpg image%d.jpg



   Extract:


Info: user$ mkvmerge -i '/folder/videoin.mkv'

Media: user$ mkvextract tracks /folder/videoin.mkv TYPE 0:/folder/videoout.MKV

Media: user$ mkvextract tracks /folder/videoin.mkv 1:/folder/audioout.ac3

Subtitles: user$ mkvextract tracks /folder/videoin.mkv -c S_TEXT/UTF8 4:subtitlesout.srt

(SRT) S_TEXT/UTF8 srt (SSA v4) S_TEXT/SSA ssa (ASS/SSA v4+) S_TEXT/ASS ass (ASS2/SSA v4++) S_TEXT/ASS ass2 (USF) S_TEXT/USF usf



   Crop:

user$ ffmpeg -i '/folder/videoin.mkv' -c:v copy -c:a copy -vf crop=720:347:0.67 '/folder/videoout.mkv'



   Unification:

user$ ffmpeg -i concat:"'/folder/folder/videoin1.vob'|'/folder/folder/videoin2.vob'|'/folder/folder/videoin3.vob'" -vcodec copy -acodec copy -s 720x576 -sar 1:1 -aspect 16:9 -r 25 -- PAL "/folder/folder/videoout.vob"





   Info:


   fonts

Free: Liberation Sans Liberation Serif Liberation Mono

Microsoft: Arial Times New Roman Courier New



   formats
 Text

odt odp ods odg txt djvu

 Audio

mka oga flac opus

 Video

mkv ogv x264 theora daala x265

 Graphic rastor

png apng

 Graphic vector

svg

 Archive

tlz

 Disk Image

iso

 Sound bank

sfz

 Dictionary

xdxf



   Hardware list
 Compact Disk

M-Disk





   Application CLI list

pwgen vnstat cmus blkid sdcv testdisk shown chmod dd cp chgrp df ls mkdir mv rm rmdir touch cat nl paste sha1sum sort split tail md5sum unexpand uniq chroot wc time date dirname du screen



   Play .mid (MIDI) files in VLC

Module smf Type Demux First VLC version 0.9.0 Description Standard MIDI Files

Module fluidsynth Type Codec First VLC version 0.9.0 Description MIDI synthesis with the FluidSynth library

VLC preferences -> Codecs -> Audio codecs -> FluidSynth -> select the .sf2

Native folder with .sf2 files /usr/share/sounds/sf2/



   FluidSynth

user$ fluidsynth -a alsa -m alsa_seq -l -i /usr/share/soundfonts/FluidR3_GM.sf2 filein.midi user$ fluidsynth -nli -r 48000 -o synth.cpu-cores=2 -T oga -F audioout.ogg /usr/share/soundfonts/FluidR3_GM.sf2 filein.mid



   Core Utilities

File utilities chgrp -------- Changes file group ownership. chown -------- Changes file ownership. chmod -------- Changes file permissions. cp ----------- Copies files. dd ----------- Copies and converts a file. df ----------- Shows disk free space on filesystems. dir ---------- Gives a brief directory listing. dircolors ---- Setup program for the color output of GNU ls. du ----------- Shows disk usage on filesystems. install ------ Copies file and sets its permissions. link --------- Creates a single file hardlink ln ----------- Creates file links. ls ----------- Lists directory contents. mkdir -------- Creates directories. mkfifo ------- Creates FIFOs (named pipes). mknod -------- Creates special files. mv ----------- Moves files. rm ----------- Removes (deletes) files. rmdir -------- Removes empty directories. shred -------- Destroy data in files. sync --------- Synchronizes filesystem buffers and disk. touch -------- Changes file timestamps. unlink ------- Removes a single file or a hardlink vdir --------- Long directory listing.

Shell utilities [ ------------ Check file types and compare values basename ----- Removes the path prefix from a given pathname. chroot ------- Changes the root directory. date --------- Prints/sets the system date and time. dirname ------ Removes the last level or filename from a given pathname. echo --------- Prints a line of text. env ---------- Displays/modifies the environment. expr --------- Evaluates expressions. factor ------- Prints prime factors. false -------- Returns an unsuccessful exit status. groups ------- Print the groups that the user is a member of. hostid ------- Print the numeric identifier for the current host hostname ----- Print or set the machine name. id ----------- Print real/effective ?uid/?gid. logname ------ Print current login name. nice --------- Modify scheduling priority. nohup -------- Allows a command to continue running after logging out. pathchk ------ Check file name portability. pinky -------- Lightweight finger printenv ----- Prints environment variables. printf ------- Formats and prints data. pwd ---------- Print the current working directory. seq ---------- Print numeric sequences. sleep -------- Suspends execution for a specified time. stty --------- Print/change terminal settings. su ----------- Allows you to adopt the id of another user or superuser. tee ---------- Sends output to multiple files. test --------- Evaluates an expression. true --------- Returns a successful exit status. tty ---------- Print terminal name. uname -------- Print system information. users -------- Print current user names. who ---------- Print a list of all users currently logged in. whoami ------- Print effective user id. yes ---------- Print a string repeatedly.

Text utilities cat ---------- Concatenate files and print to the standard output cksum -------- Checksum and count the bytes in a file comm --------- Compare two sorted files line by line csplit ------- Split a file into sections determined by context lines cut ---------- Remove sections from each line of files expand ------- Convert tabs to spaces fmt ---------- Simple optimal text formatter fold --------- Wrap each input line to fit in specified width head --------- Output the first part of files join --------- Join lines of two files on a common field md5sum ------- Compute and check MD5 message digest nl ----------- Number lines of files od ----------- Dump files in octal and other formats paste -------- Merge lines of files pr ----------- Convert text files for printing ptx ---------- Produce a permuted index of file contents sort --------- Sort lines of text files split -------- Split a file into pieces sum ---------- Checksum and count the blocks in a file tac ---------- Concatenate and print files in reverse tail --------- Output the last part of files tr ----------- Translate or delete characters tsort -------- Perform topological sort unexpand ----- Convert spaces to tabs uniq --------- Remove duplicate lines from a sorted file wc ----------- Print the number of bytes, words, and lines in files