190 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| created: 2024-01-29T05:19:01.392Z
 | |
| type: topic
 | |
| updated: 2024-12-05T14:57:36.000Z
 | |
| ---
 | |
| 
 | |
| # Ubuntu
 | |
| 
 | |
| - [Barcode Host](../.kanbn/archive/barcode-host.md)
 | |
| 
 | |
| ```bash
 | |
| uname -a
 | |
| hostnamectl
 | |
| lsb_release -a
 | |
| cat /etc/issue
 | |
| cat /etc/os-release
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| sudo -l
 | |
| timedatectl set-timezone America/Phoenix
 | |
| find / -name "secrets.json" 2>/dev/null
 | |
| ls -1 | wc -l
 | |
| cp -R -u -p /source /destination
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| cd /home
 | |
| # directory percent tree
 | |
| ncdu
 | |
| ncdu --sort=name-desc
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| adduser syncthing
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # Free space
 | |
| df -h --total
 | |
| vgdisplay
 | |
| lvdisplay
 | |
| lsblk
 | |
| apt install smartmontools
 | |
| smartctl -i /dev/sda
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # mount
 | |
| mount /dev/sda4 /mnt
 | |
| umount /dev/sda4
 | |
| # mount -o remount,uid=1000,gid=1000,rw /dev/sda4
 | |
| # mount -t ntfs -o nls=utf8,umask=0222 /dev/sda4 /mnt
 | |
| # mount -t ntfs -o ro /dev/sda4 /mnt
 | |
| # mkdir /home/mike/1-Images-A
 | |
| # mount --bind /mnt/1-Images-A /home/mike/1-Images-A
 | |
| # mount -o remount,rw /home/mike/1-Images-A
 | |
| # umount /home/mike/1-Images-A
 | |
| # rm -R /home/mike/1-Images-A
 | |
| mkfs -t ext4 /dev/sda4
 | |
| mount /dev/sda4 /mnt
 | |
| blkid
 | |
| ```
 | |
| 
 | |
| ```conf
 | |
| /dev/sda4: UUID="27753635-40b1-4f21-8f6c-28b1c1997cfb" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="b920a38c-4682-4c16-9abd-a385fd57b29d"
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://askubuntu.com/questions/45607/how-to-mount-partition-permanently
 | |
| nano /etc/fstab
 | |
| ```
 | |
| 
 | |
| ```conf
 | |
| /dev/disk/by-uuid/27753635-40b1-4f21-8f6c-28b1c1997cfb /mnt ext4 defaults 0 2
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| fdisk -l
 | |
| lvdisplay
 | |
| lvm lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
 | |
| esize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| apt-get install lshw
 | |
| lshw -class disk -class storage
 | |
| lshw -html > /var/www/html/my-specs.html
 | |
| nano /var/www/html/my-specs.html
 | |
| apt-get install smartmontools
 | |
| smartctl -i /dev/sda
 | |
| apt-get install hdparm
 | |
| hdparm -I /dev/sda
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://stackoverflow.com/questions/338037/how-to-check-permissions-of-a-specific-directory
 | |
| ls -la
 | |
| namei -l
 | |
| getfacl
 | |
| stat -c "%n %a"
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/
 | |
| sed -i 's/net8.0/net6.0/g' Shared/OI.Metrology.Shared.csproj
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # all users
 | |
| compgen -u
 | |
| # all groups
 | |
| compgen -g
 | |
| usermod -a -G docker mike
 | |
| groups list mike
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://stackoverflow.com/questions/49249375/how-to-disable-cloud-init-networking
 | |
| /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
 | |
| ```
 | |
| 
 | |
| ```yaml
 | |
| network: {config: disabled}
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://intercom.help/privatevpn/en/articles/6440374-how-to-disable-ipv6-on-ubuntu-and-fedora-linux
 | |
| nano /etc/sysctl.conf
 | |
| ```
 | |
| 
 | |
| ```conf
 | |
| net.ipv6.conf.all.disable_ipv6 = 1
 | |
| net.ipv6.conf.default.disable_ipv6 = 1
 | |
| net.ipv6.conf.lo.disable_ipv6 = 1
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| sysctl -p
 | |
| cat /proc/sys/net/ipv6/conf/all/disable_ipv6
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # https://www.omgubuntu.co.uk/2021/07/enable-minimize-click-ubuntu-dock
 | |
| gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # View package virtual IP per Peter Kim
 | |
| mviewcl
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| apt list --installed
 | |
| lsof -i -P -n | grep LISTEN
 | |
| lsblk -I 8 -o NAME,SIZE,TYPE,FSUSED,FSUSE%
 | |
| lsblk -b -o NAME,SIZE,TYPE,VENDOR,MODEL,SERIAL
 | |
| (echo >/dev/tcp/localhost/22) &>/dev/null && echo "Open 22" || echo "Close 22"
 | |
| ```
 | |
| 
 | |
| ## Find symbolic links
 | |
| 
 | |
| - [how-to-list-all-symbolic-links-in-a-directory](https://askubuntu.com/questions/522051/how-to-list-all-symbolic-links-in-a-directory)
 | |
| 
 | |
| ```bash Wed Jul 31 2024 11:19:12 GMT-0700 (Mountain Standard Time)
 | |
| find . -type l -ls
 | |
| find . -type f -maxdepth 1 |  wc -l 
 | |
| ```
 | |
| 
 | |
| ## Save and Restore Permissions
 | |
| 
 | |
| - [is-it-possible-to-create-a-script-to-save-and-restore-permissions](https://stackoverflow.com/questions/3450250/is-it-possible-to-create-a-script-to-save-and-restore-permissions)
 | |
| 
 | |
| ```bash Wed Jul 31 2024 13:25:41 GMT-0700 (Mountain Standard Time)
 | |
| getfacl -R yourDirectory > permissions.acl
 | |
| setfacl --restore=permissions.acl
 | |
| tree -ap>tree.txt
 | |
| ```
 | |
| 
 | |
| ## NVMe Slot Gen
 | |
| 
 | |
| - [how-to-determine-from-command-line-if-nvme-slot-is-gen-3-or-gen-](https://askubuntu.com/questions/1428578/how-to-determine-from-command-line-if-nvme-slot-is-gen-3-or-gen-4#:~:text=Here%20we%20can%20see%20the,generation%20of%20the%20PCIe%20itself.&text=Here%20we%20can%20see%20the%20slot%20supports%20up%20to%2016,s%20thence%20it%20is%20Gen4)
 | |
| 
 | |
| ```bash 1731286496058 = 638668832960580000 = Sun Nov 10 2024 17:54:55 GMT-0700 (Mountain Standard Time)
 | |
| lspci | grep -i nvme
 | |
| # 02:00.0 Non-Volatile memory controller: Sandisk Corp WD Black SN770 / PC SN740 256GB / PC SN560 (DRAM-less) NVMe SSD (rev 01)
 | |
| lspci -vv -s 02:00.0 | grep -w LnkCap
 | |
| # LnkCap: Port #0, Speed 16GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
 | |
| ```
 |