helpful_ubuntu_commands
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| helpful_ubuntu_commands [2026/03/22 10:00] – mike | helpful_ubuntu_commands [2026/08/08 20:15] (current) – mike | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Helpful Ubuntu/ | ====== Helpful Ubuntu/ | ||
| - | ---- | + | ==== Miscellaneous/ |
| === Disable Ubuntu Pro " | === Disable Ubuntu Pro " | ||
| - | <color red> | ||
| sudo pro config set apt_news=false | sudo pro config set apt_news=false | ||
| Line 42: | Line 42: | ||
| === Determine the date the system was installed (not 100% reliable) === | === Determine the date the system was installed (not 100% reliable) === | ||
| tune2fs -l /dev/vda2 | grep ‘Filesystem created:’ (replace vda2 with device where root filesystem is located) | tune2fs -l /dev/vda2 | grep ‘Filesystem created:’ (replace vda2 with device where root filesystem is located) | ||
| - | | + | |
| + | === Copy an existing partition to a new partition === | ||
| + | sudo rsync -aAXv --info=progress2 --exclude='/ | ||
| === Finding largest files/ | === Finding largest files/ | ||
| du -a /dir/ | sort -n -r | head -n 20 (replace 20 with the # of lines you wish to have returned) | du -a /dir/ | sort -n -r | head -n 20 (replace 20 with the # of lines you wish to have returned) | ||
| Line 55: | Line 58: | ||
| Create (or edit, if it exists) ~/.vimrc; into this file add the command syntax off, and save the file. | Create (or edit, if it exists) ~/.vimrc; into this file add the command syntax off, and save the file. | ||
| - | **Overwrite/ | ||
| - | |||
| - | dd if=/ | ||
| - | | ||
| === Find files consuming the root file system === | === Find files consuming the root file system === | ||
| mkdir / | mkdir / | ||
| Line 73: | Line 72: | ||
| OTA DVR recordings are saved as **.ts** files, which are not compatible with DaVinci Resolve (my video editor of choice). | OTA DVR recordings are saved as **.ts** files, which are not compatible with DaVinci Resolve (my video editor of choice). | ||
| ffmpeg -i < | ffmpeg -i < | ||
| + | |||
| + | **Overwrite/ | ||
| + | |||
| + | dd if=/ | ||
| + | |||
| + | ==== Ansible/ | ||
| | | ||
| === Generate password hashes (useful for Ansible playbooks amongst other things) === | === Generate password hashes (useful for Ansible playbooks amongst other things) === | ||
| mkpasswd --method=sha-512 | mkpasswd --method=sha-512 | ||
| + | |||
| + | === Generate random keys === | ||
| + | openssl rand -base64 48 | ||
| + | |||
| + | === Example of referencing an Ansible Vault === | ||
| + | ansible-playbook playbook.yml --vault-password-file ~/ | ||
| | | ||
| ==== Extracting encrypted/ | ==== Extracting encrypted/ | ||
| Line 101: | Line 112: | ||
| Restart apache. | Restart apache. | ||
| - | === Create new GPT disk partition === | + | ==== Create new GPT disk partition |
| sudo into an elevated shell and then perform the following: | sudo into an elevated shell and then perform the following: | ||
| parted /dev/sdX (where X is the letter of the drive to be manipulated) | parted /dev/sdX (where X is the letter of the drive to be manipulated) | ||
| Line 126: | Line 137: | ||
| Edit the **/ | Edit the **/ | ||
| Apply the changes with the **sudo netplan apply** command | Apply the changes with the **sudo netplan apply** command | ||
| + | |||
| + | === Disabling the local DNS resolver === | ||
| + | This becomes necessary if a DNS server is deployed on the local system, since it will conflict with the local resolver unless it is first disabled. | ||
| + | |||
| + | Edit **/ | ||
| + | DNSStubListener=no | ||
| + | |||
| + | Update the **resolv.conf** symlink: | ||
| + | sudo ln -sf / | ||
| + | | ||
| + | Restart **systemd-resolved**: | ||
| + | sudo systemctl restart systemd-resolved | ||
| + | | ||
| + | Validate that the system is no longer listening on port 53: | ||
| + | ss -tulpn | grep 53 | ||
| + | | ||
| + | ==== Creating SSH Keys ==== | ||
| + | To create an ed25519 key - | ||
| + | ssh-keygen -t ed25519 -C "< | ||
helpful_ubuntu_commands.1774198816.txt.gz · Last modified: by mike
