Unix Memos Collection Marc Zonzon Sep 03, 2019 CONTENTS 1 Introduction 3 2 Linux Commands Memo5 2.1 basic.................................................5 2.2 files..................................................5 2.3 dir navigation.............................................5 2.4 File searching.............................................6 2.5 disk space...............................................6 2.6 text handling.............................................7 2.7 encryption..............................................7 2.8 archives and compression......................................8 2.9 process management.........................................9 2.10 monitoring, process admin...................................... 10 2.11 Users................................................. 10 2.12 system information.......................................... 11 2.13 sed.................................................. 11 2.14 File attributes, Extended Attributes and ACL............................ 11 2.15 Desktop management........................................ 12 2.16 Images manipulation......................................... 12 2.17 Pdf.................................................. 13 2.18 Refs.................................................. 13 3 Network Commands Memo 15 3.1 rsync................................................. 15 3.2 ssh.................................................. 15 3.3 wget................................................. 16 3.4 networking.............................................. 16 3.5 network manager........................................... 17 4 Shell Memo 19 4.1 Differences between zsh and bash scripts............................... 19 4.2 exit and return ......................................... 20 4.3 Reading a query string........................................ 21 4.4 Links................................................. 22 4.5 capturing input............................................ 23 4.6 command return status........................................ 23 4.7 Command Expansion......................................... 23 4.8 file descriptors............................................ 28 4.9 Elapsed time of a command..................................... 33 4.10 array indexes and globbing...................................... 34 4.11 bash and zsh regex expressions.................................... 34 4.12 Using getopts............................................ 35 4.13 using getopt............................................. 35 5 Portable Shell constructs 37 i 5.1 Utilities used in a shell script..................................... 37 5.2 Converting bash syntax to dash................................... 37 6 Systemd 39 6.1 systemctl............................................... 39 6.2 journalctl............................................... 39 7 Debian Package Config Memo 41 7.1 dpkg Memo.............................................. 41 7.2 apt/aptitude memo.......................................... 43 8 Access Control List 49 8.1 ACL References........................................... 49 8.2 Access acl.............................................. 49 8.3 Default acl............................................... 49 8.4 Using acl to control access...................................... 50 8.5 My acl to protect crypt and other sensitive data............................ 50 9 File Attributes 51 9.1 References.............................................. 51 9.2 attributes memo........................................... 51 9.3 Extended file attributes........................................ 52 10 Memory and swap management 53 10.1 Inspecting and tuning ram...................................... 53 10.2 Managing swap space........................................ 53 11 Udev device Management and usb devices 55 11.1 References.............................................. 55 11.2 localrules............................................... 55 11.3 finding usb devices.......................................... 55 11.4 Using /sys keys............................................ 56 12 Operating on disk devices 59 12.1 Listing devices............................................. 59 12.2 Determine the file system of an unmounted partition......................... 61 12.3 Mounting devices as user....................................... 61 12.4 Mounting a partition in a FileManager................................ 62 12.5 Front ends for mounting removable devices............................. 62 12.6 Udisks references........................................... 63 12.7 Loop Devices............................................. 63 13 BTRFS 65 13.1 Filesystem.............................................. 65 13.2 Filesystem integrity......................................... 66 13.3 Subvolume.............................................. 66 13.4 Snapshots............................................... 67 13.5 Btrfs send............................................... 68 13.6 Btrfs raid............................................... 68 13.7 Btrfs References........................................... 70 14 Virtual File Systems 71 14.1 GVFS................................................. 71 14.2 MTP................................................. 73 15 Encrypted file systems 77 15.1 DM-Crypt.............................................. 77 16 GnuPG Memo 79 16.1 list of keys............................................... 80 ii 16.2 signing................................................. 80 16.3 Verifying a signature.......................................... 80 16.4 Encrypting............................................... 81 16.5 Decrypting............................................... 82 16.6 available ciphers............................................ 82 16.7 receiving keys............................................. 82 16.8 refreshing keys............................................. 82 16.9 creating a key............................................. 83 16.10 Exporting a key............................................ 83 16.11 importing a key............................................ 83 16.12 Editing your keys........................................... 84 16.13 Replacing old dsa key by a new rsa one................................ 86 16.14 References.............................................. 87 17 FreeDesktop Structure 89 17.1 References.............................................. 89 17.2 XDG menus............................................. 89 17.3 XDG Default application....................................... 90 17.4 Managing default applications with xdg-utils............................. 90 17.5 The mimeapps file........................................... 91 17.6 Freedesktop Directories....................................... 92 17.7 Menu specification........................................... 93 17.8 Autostart applications........................................ 93 18 Network commands 95 18.1 nmap................................................. 95 19 SSH 97 19.1 ssh memo............................................... 97 19.2 ssh keys................................................ 98 19.3 ssh agent................................................ 101 19.4 Ssh port forwarding......................................... 104 19.5 Keeping a ssh session alive...................................... 106 19.6 Reverse ssh connection........................................ 107 19.7 Cipher Performances......................................... 107 19.8 sshd config.............................................. 108 19.9 ssh config............................................... 109 19.10 ssh debugging............................................ 110 19.11 Fish.................................................. 111 19.12 SSH References........................................... 111 20 Wpa_supplicant 113 20.1 Using wpa_supplicant........................................ 113 21 Working with PDF/DJVU 117 21.1 Selecting and merging......................................... 117 21.2 PDF compression........................................... 118 21.3 Extracting objects from pdf..................................... 120 21.4 Creating djvu document....................................... 122 21.5 Working with djvu........................................... 123 21.6 PDF and DJVU bookmarks..................................... 125 22 DVD and CD 127 22.1 Knowing about your drive....................................... 127 22.2 Working with iso images....................................... 128 22.3 Make iso image from a directory................................... 129 22.4 Extract an iso image from a CD/DVD................................. 129 22.5 Verifying the burnt image....................................... 129 22.6 Media Type and Capacity...................................... 130 iii 22.7 Burn an iso image.......................................... 130 23 Tmux 133 23.1 Table of Tmux Keys......................................... 133 23.2 Tmux commands........................................... 135 23.3 Mouse support............................................ 138 23.4 Configurations Options:....................................... 138 23.5 References.............................................. 138 24 VI(M) reference card 139 24.1 Basic movement........................................... 139 24.2 Insertion & replace ! insert mode................................. 139 24.3 Deletion............................................... 140 24.4 Insert mode.............................................. 140 24.5 Copying..............................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages159 Page
-
File Size-