Linux command lines

> filename.ext true > filename.ext
 * Clear a file

scp @: 
 * Copy file from remote host to local host ( is defined in /home//.ssh/config). Open terminal on local host:

dd if=/dev/sdb of=/media/ /file.img bs=32M conv=noerror,sync
 * Create hdd image

ifconfig sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
 * Disable IPv6

sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
 * Enable IPv6

cd / touch /forcefsck
 * Force disk check

apt-cache rdepends 
 * List dependent packages

service --status-all
 * List services

mount -o loop file.iso /mnt/dir
 * Mount image

1. Create keys:
 * SSH configuration

ssh-keygen -t 

2. Edit /etc/ssh/sshd_config:

AuthorizedKeysFile    %h/.ssh/authorized_keys PermitRootLogin no ChallengeResponseAuthentication no  PasswordAuthentication no  UsePAM no  AuthenticationMethods publickey PubkeyAuthentication yes AllowUsers  3. Copy public key to the target machine 4. Restart sshd service

inxi v2 lshw lspci
 * System information

sudo apt-get install update-manager-core sudo nano /etc/update-manager/release-upgrades - set Prompt=lts sudo do-release-upgrade -d
 * Upgrade ubuntu server

ssh-keygen -t ed25519 -C "me@server.srv"
 * Create SSH key

[Resolve] DNS=8.8.8.8 8.8.4.4 #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no Cache=yes DNSStubListener=yes
 * Solve NXDOMAIN error
 * systemctl status systemd-resolved
 * /etc/nsswitch.conf -> "hosts: resolve files dns"
 * /etc/systemd/resolved.conf


 * sudo systemctl restart systemd-resolved
 * systemctl status systemd-resolved

lsof -p $(pidof )
 * List open files by process