MyBashHistory v86

in #linux8 years ago (edited)

debian.png
Image source: Willi Glenz - MyDebianDesktop


UPDATE
20180907 $ find ~ -maxdepth 1 -type f -mtime 3
20180907 $ find ~ -maxdepth 1 -type f -exec grep "^alias " '{}' \; -print
20180907 PACKAGE TRIPWIRE
# apt-get install tripwire
$ apt-cache show tripwire
$ man tripwire
$ w3m https://github.com/Tripwire/tripwire-open-source
> Creating a baseline: # tripwire --init
> Running a check: # tripwire --check --verbose
> Printing a report: # twprint -m r -t [0-4] -r /path/to/reportfile.twr
> Updating the database: # tripwire --update --accept-all
20180906 Rheinwerk OpenBook $ w3m https://www.rheinwerk-verlag.de/openbook/
20180905 Open Books $ w3m https://www.oreilly.com/openbook
20180905 ~/.bashrc > alias l='ls -hog'
20180905 ~/.bashrc > alias L='clear; ls -hog'
20180904 $ ls -l | xsel --clipboard
20180904 LinuxFromScratch $ w3m  http://www.linuxfromscratch.org
20180904 Google Sheets * =SVERWEIS(max($A$12:$A); $A$12:P; SPALTE(P2); WAHR)
20180903 $ w3m https://www.commandlinefu.com
20180903 Java - AWT-Reference $ w3m https://www.oreilly.com/openbook/javawt/book/index.html
20180902 $ w3m https://www.gnu.org/software/grub/manual/grub/grub.html
20180902 # grub-mkconfig -o /boot/grub/grub.cfg
20180901 # apt-get install kismet


LINUX ABC
A - alias apt-cache apt-get archivemount atop awk
B - bashrc bc blkid
C - cat chkrootkit chown cut
D - dd df diff dpkg du
F - fdisk file find
G - grub-mkconfig guake
H - head htop hwinfo
I - info
K - kismet
L - less lsb_release lsblk lvm
M - man mc
N - nmap nl
P - pwd pwgen
R - raspi-config rpi-update rsync
S - sed sort ssh swapon
T - tac tail tasksel top touch tripwire
U - uniq update-alternatives users
V - veracrypt vim vimtutor visudo vlc
W - w wc w3m whoami
X - xsel


LIFECYCLE MANAGEMENT
Basics: Debian RaspPi 
Tools : aview backintime-qt4 espeak gkrellm guake hwinfo kismet libreoffice mc powertop sudo taskwarrior terminator vim vym
 
INSTALLATION
* Raspberry Pi $ w3m https://www.raspberrypi.org/downloads/raspbian/
* Raspberry Pi $ dd bs=4M if=2018-04-18-raspbian-stretch.img of=/dev/sdX status=progress conv=fsync
* Debian       $ w3m https://www.debian.org/distrib/netinst#smallcd
# apt-get install aview backintime-qt4 espeak gkrellm guake hwinfo kismet libreoffice mc powertop sudo taskwarrior terminator vim vym

CONFIGURATION
* ~/.bashrc     $ vim ~/.bashrc
* ~/.bashrc     > HISTCONTROL=ignoreboth:erasedups
* ~/.bashrc     > export PATH=$HOME/scripts:$PATH
* ~/.bashrc     > alias c='clear; ncal -3wy'        
* ~/.bashrc     > alias h='clear; history 25'
* ~/.bashrc     > alias l='ls -hog'
* ~/.bashrc     > alias L='clear; ls -hog'
* ~/.bashrc     $ . ~/.bashrc
* Raspberry Pi  $ w3m https://www.raspberrypi.org/documentation/configuration/
* Raspberry Pi  # raspi-config
* Vim           # update-alternatives --config editor

INFORMATION GATHERING
* Basics  : whoami tuptime pwd users w top htop atop ps kill jobs strg-z fg
* Disk    $ lsblk 
* Disk    $ df -hT
* Swap    $ cat /etc/fstab | grep -i swap
* Swap    # swapon -s
* Distro  $ lsb_release -a
* Wlan # apt-get install kismet
$ find ~ -maxdepth 1 -type f -mtime 3
$ find ~ -maxdepth 1 -type f -exec grep "^alias " '{}' \; -print
$ apt-cache show vlc | less

SECURITY
# apt-get update && apt-get upgrade && apt-get dist-upgrade
# rpi-update
# chkrootkit
# rkhunter --check --sk
$ pwgen -s 12
$ w3m https://www.debian.org/News/2018
$ w3m https://www.debian.org/security/#DSAS
$ w3m https://www.veracrypt.fr/en/Documentation.html
$ w3m http://sectools.org

BACKUP
$ archivemount archive.tar.gz ~/mnt/
# dd if=/dev/sdABC of=/dev/sdXYZ bs=64K conv=noerror,sync
$ tar -cvzf ~/backup/backup.tar.gz ~/java
$ tar -tvf backup.tar.gz 
$ rsync -avzP --delete --stats /media/abc/ /media/xyz
$ ssh [email protected] "tar -zcf - /home/user/scripte" > scripte.tar.gz

TROUBLESHOOTING
# dstat
# testdisk
# grub-mkconfig  -o /boot/grub/grub.cfg 


HARDWARE MANAGEMENT
Tools:  fdisk hwinfo lshw mount lvm

$ mount | column -t
# hwinfo --short | less
# hwinfo --disk
# lshw -short | less
# fdisk -l
$ cat /sys/devices/virtual/thermal/thermal_zone0/temp
# blkid /dev/sda1

LVM
# apt-get install lvm2
$ apt-cache show lvm2
$ man lvm
# fdisk -l

SOURCES
* Linux on the Road     $ w3m http://www.tldp.org/LDP/Mobile-Guide/html/index.html
* Raspberry Pi          $ w3m https://www.raspberrypi.org/documentation


APPLICATION MANAGEMENT
Tools:  vim task

GOOGLE SHEETS
* =SVERWEIS(max($A$12:$A); $A$12:P; SPALTE(P2); WAHR)

VIM
* strg-wv strg-wr strg-wc
$ dpkg -L vim-doc
$ EDITOR=/usr/bin/vim
$ VISUAL=$EDITOR
$ export EDITOR VISUAL
# update-alternatives --config editor
$ vimtutor
$ vim Main.java
$ Strg-x e
$ w3m https://linux.die.net/man/1/vim
$ w3m https://www.vim.org
~/.vimrc
" GENERAL
syntax on
set number
set ruler
"set hls
set background=dark
set encoding=utf8
set mouse=a
" INDENT
set autoindent
" TABs
set tabstop=3
set softtabstop=3
set shiftwidth=3
set expandtab
" MAPs
nmap <leader>w :w!<cr>
map <F2> :echo 'Current time is ' . strftime('%c')<CR>

TASKWARRIOR
Installation & Configuration
$ apt-cache search taskwarrior
$ apt-cache show taskwarrior
# apt-get install taskwarrior
$ vim ~.taskrc
$ w3m https://linux.die.net/man/1/task
Basic Task Management
$ task
$ task add Task1
$ task add Task2
$ task
$ task 1 modify priority:H
$ task 1 modify due:eow
$ task 1 start
$ task 1 stop
$ task 1 information
$ task
$ task 1 done
$ task 2 delete
$ task
$ task burndown
$ alias t='clear; task'
$ alias t1='clear; task burndown.daily'
Documentation
$ man task
$ w3m https://taskwarrior.org
$ w3m https://taskwarrior.org/docs
$ w3m https://taskwarrior.org/docs/30second.html
$ w3m https://linux.die.net/man/1/task


FILE MANAGEMENT
Basics  : pwd - cd - ls - file - touch
Tools   : chown - df - du - find - veracrypt
Paths   : /etc /var/log /bin /usr/bin /sbin 

$ ls -l | xsel --clipboard
# chown userXYZ file.txt
$ df -hT
# du -hs / 2> /dev/null
$ du -h --max-depth=1 | sort -rh
$ du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e'
# find /home -user userxyz -size +1G
# find /home -user userxyz -mtime -3
# find / -uid 1000 -exec chown -v 1002:1002 {} \;
$ find . -name "*.jpg" -exec convert {} -scale 50% +repage {} \;
# find / -user userxyz -type f -exec rm -f {} \;
# visudo
$ for x in *; do mv "$x" "${x,,}"; done
$ java -jar filename.jar
$ type echo 
$ type date
$ man hier
$ dpkg -L vim-doc

SECURITY
* VeraCrypt     $ w3m https://www.veracrypt.fr/en/Documentation.html


USER MANAGEMENT
Tools : useradd userdel usermod adduser passwd id groupadd groupdel groupmod addgroup
Files : ~/.bashrc ~/.profile /etc/group /etc/passwd /etc/profile /etc/shadow /etc/adduser.conf /etc/default/useradd 

# adduser user2
# useradd -D
# usermod -c "TestUser" user2
# userdel -r user2
# find /home -uid 1000 | wc -l
# find /home -uid 1000 | tee 1000-files.txt
# find / -uid 1000 -exec chown -v 1002:1002 {} \;
$ ls -l /etc/skel
$ id -u user1
$ id -u root
$ id user1
# chown -R user2:user2 /home/user1
$ cut -d: -f1 < /etc/passwd | sort | xargs

PASSWORD
# passwd user1
# passwd -S user1


SYSTEM MANAGEMENT
# visudo
$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
$ gnome-<tab><tab>
# ls<tab><tab>
# init 0
# shutdown -r now
# shutdown -c
# shutdown -h 1:00
$ cat /etc/shells$ uname -v
$ unset HISTFILE
$ PI=$(echo "scale=10; 4*a(1)" | bc -l)

MONITORING
$ uptime
$ tuptime
$ top
# atop
# htop
$ vmstat 2 10
$ dstat
$ whowatch
$ w
# tail -f /var/log/messages
# tail -fvn 25 /var/log/messages
# less +F /var/log/messages
$ ps hax -o user | sort | uniq -c
$ free -h
$ xload -update 1 -nolabel &
# cat /var/log/messages | awk '{print substr($0,0,12)}' | uniq -c | sort -nr | awk '{printf("\n%s ",$0) ; for (i = 0; i<$1 ; i++) {printf("*")};}' | less
$ w3m https://www.zabbix.com
$ dstat -f 60 24
# dmesg --level=err,warn -T
$ efibootmgr

TIME
# vim /etc/crontab
$ ls -l /etc/cron* | less

KERNEL
$ lsmod | wc -l
$ w3m https://www.kernel.org

MULTIMEDIA
$ mpg123 -zvC /home/user/music/*
$ youtube-dl --list-formats https://a.b/XlytFabwHZs


NETWORK MANAGEMENT
$ speedometer -r eth0
# arp-scan 192.168.0.0/24
# iw dev wlan0 scan | egrep "SSID|signal" | awk -F ":" '{print $2}' | sed 'N;s/\n/:/' | sort
$ curl ifconfig.me
$ mtr --curses google.com
# netstat -tulpn
$ netstat -a | less
# ifconfig -a | grep -Po '\b(?!255)(?:\d{1,3}\.){3}(?!255)\d{1,3}\b' | xargs nmap -A -p0-
$ ssh -X [email protected]
$ python -m SimpleHTTPServer
$ w3m myip.is

CONFIGURATION
# vim /etc/ssh/ssh_config
$ cat /etc/hosts
# vim /etc/hosts
# macchanger -r eth0

HOSTS
$ sntop
$ ip a
$ sshfs name@server:/path/to/folder /path/to/mount/point
# ifconfig eth0 down | up
$ nmap --iflist
$ nmap -A -T4 192.168.0.199
$ nmap -sP 192.168.1.0/24

ROUTING
$ nmap --iflist
$ ip -r

DOCUMENTATION
$ w3m http://www.linuxhowtos.org/Security/understandssh.htm
$ w3m https://linux.die.net/Intro-Linux/chap_10.html


SERVER MANAGEMENT
# tasksel --list-tasks

RASPBERRY PI
$ ssh -X [email protected]
# raspi-config


SOURCES
* Bash                          $ w3m https://www.tecmint.com/linux-commands-cheat-sheet/
* Bash - BBG                    $ w3m http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html
* Bash - ABS                    $ w3m http://www.tldp.org/LDP/abs/html/index.html
* Bash - ComandLineFu           $ w3m https://www.commandlinefu.com
* Bash - Die.net                $ w3m https://www.die.net
* Bash - Pure Bash Bible        $ w3m https://github.com/dylanaraps/pure-bash-bible
* Bash - Commandlinefu.com      $ w3m https://www.commandlinefu.com
* Bash - Command-Line-Tools     $ w3m http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/index.html
* Bash - CheatSheet             $ curl cheat.sh
* Debian                        $ w3m https://distrowatch.com/table.php?distribution=debian
* Debian Homepage               $ w3m https://www.debian.org -dump | less
* Debian Download               $ w3m https://www.debian.org/distrib/netinst#smallcd
* Debian Handbook               # apt-get install debian-handbook
* Debian Handbook               $ dpkg -L debian-handbook 
* Debian Reference              # apt-get install debian-reference-en
* Debian Reference              $ dpkg -L debian-reference
* Debian Wiki                   $ w3m https://wiki.debian.org/FrontPage
* Debian Refcard                # apt-get install debian-refcard
* Debian Refcard                $ dpkg -L debian-refcard
* Debian Refcard                $ w3m /usr/share/doc/debian-refcard/index.html
* Gimp                          $ w3m https://www.gimp.org  
* Grub                          $ w3m https://www.gnu.org/software/grub/manual/grub/grub.html
* Java - Tutorialspoint         $ w3m https://www.tutorialspoint.com/java/index.htm
* Java - Bradley Kjell          $ w3m http://chortle.ccsu.edu/java5/index.html
* Java - AWT-Reference          $ w3m https://www.oreilly.com/openbook/javawt/book/index.html
* LibreOffice                   $ w3m https://www.libreoffice.org
* Linux                         $ w3m https://www.linuxlinks.com
* Linux                         $ w3m http://www.tldp.org/LDP/intro-linux/html/index.html
* LinuxFromScratch              $ w3m http://www.linuxfromscratch.org
* Open Books - O'Reilly         $ w3m https://www.oreilly.com/openbook
* Open Books - Rheinwerk        $ w3m https://www.rheinwerk-verlag.de/openbook/
* R - Introduction to R Programming $ w3m https://youtu.be/92zCRV3eQxw
* Scribus                       $ w3m https://www.scribus.net
* TLDP                          $ w3m http://www.tldp.org
* MAN Pages                     $ man -t man | ps2pdf - man.pdf
* MAN Pages                     $ man -k scanner
* MAN Pages                     $ apropos . | shuf -n 1 | awk '{print$1}' | xargs man
* MAN Pages                     $ man man
* Info Pages                    $ info info

WEATHER
$ curl wttr.in/~wasserkuppe?lang=de
$ curl wttr.in/bad+kissingen?lang=de
$ curl wttr.in/fulda?lang=de
$ curl wttr.in/~odenwald+reichelsheim?lang=de
$ curl wttr.in/~valletta
$ curl wttr.in/:help

BITCOIN
$ curl rate.sx

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.084
BTC 60911.74
ETH 1565.41
USDT 1.00
SBD 0.47