helpful_ubuntu_commands
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| helpful_ubuntu_commands [2024/12/24 08:05] – created mike | helpful_ubuntu_commands [2025/12/06 10:01] (current) – mike | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Helpful Ubuntu/ | + | ====== Helpful Ubuntu/ |
| ---- | ---- | ||
| + | === Disable Ubuntu Pro " | ||
| + | <color red> | ||
| + | sudo pro config set apt_news=false | ||
| + | |||
| === List hard drive serial numbers === | === List hard drive serial numbers === | ||
| lsblk --nodeps -o name,serial | lsblk --nodeps -o name,serial | ||
| Line 6: | Line 10: | ||
| === List processes and the ports they are listening on === | === List processes and the ports they are listening on === | ||
| netstat -tulpn | grep LISTEN | netstat -tulpn | grep LISTEN | ||
| + | or | ||
| + | ss -tulpn | grep LISTEN | ||
| | | ||
| === Reload systemd manager configuration after changes made === | === Reload systemd manager configuration after changes made === | ||
| Line 18: | Line 24: | ||
| === Changing default editor for visudo === | === Changing default editor for visudo === | ||
| sudo update-alternatives --config editor | sudo update-alternatives --config editor | ||
| + | |||
| + | If visudo complains about a missing defaults.vim file, it can be fixed thusly: | ||
| + | sudo touch ~root/.exrc | ||
| | | ||
| === Disable GUI screen lock === | === Disable GUI screen lock === | ||
| Line 36: | Line 45: | ||
| === 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) | ||
| + | |||
| + | === Find the oldest file in a directory (and it's subdirectories) === | ||
| + | find . -type f -printf '%T+ %p\n' | sort | head -n 1 | ||
| + | | ||
| + | === Finding files by file name (or file name portion) === | ||
| + | find . -iname < | ||
| + | | ||
| + | === Disable colors in the vi editor by default === | ||
| + | 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 === | ||
| + | mkdir / | ||
| + | mount --bind / / | ||
| + | du -d 1 -h / | ||
| + | |||
| + | === Solution for Linux systems not visible in the " | ||
| + | apt install wsdd | ||
| + | | ||
| + | === View video resolution capabilities === | ||
| + | xrandr -q | ||
| + | |||
| + | === Converting OTA DVR recordings to .MP4 === | ||
| + | OTA DVR recordings are saved as **.ts** files, which are not compatible with DaVinci Resolve (my video editor of choice). | ||
| + | ffmpeg -i < | ||
| + | | ||
| + | === Generate password hashes (useful for Ansible playbooks amongst other things) === | ||
| + | mkpasswd --method=sha-512 | ||
| + | ==== Cookbook for passing client IP address to systems behind a reverse proxy ==== | ||
| + | === On the reverse proxy: === | ||
| + | Ensure that websockets support is enabled | ||
| + | |||
| + | === On the host: === | ||
| + | Create / | ||
| + | RemoteIPHeader X-Forwarded-For | ||
| + | RemoteIPTrustedProxy x.x.x.x (replace w/ IP address of trusted proxy) | ||
| + | | ||
| + | Execute the commands: | ||
| + | ln / | ||
| + | ln / | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | Restart apache. | ||
| + | |||
| + | === Create new GPT disk partition === | ||
| + | sudo into an elevated shell and then perform the following: | ||
| + | parted /dev/sdX (where X is the letter of the drive to be manipulated) | ||
| + | mklabel gpt | ||
| + | Acknowledge the warning if one is given | ||
| + | unit TB | ||
| + | mkpart primary 0.00TB 2.00TB (or 3.00TB, 4.00TB, etc. depending on the size to be created) | ||
| + | print (to view the new partition) | ||
| + | quit (to exit parted) | ||
| + | |||
| + | Then proceed to format the new drive, i.e. **mkfs -t ext4 /dev/sdb1** | ||
| + | |||
| + | ==== Changing the server' | ||
| + | sudo vi / | ||
| + | find the existing IP and change it to the desired IP; ' | ||
| + | sudo netplan apply | ||
| + | | ||
| + | ==== Changing the server' | ||
| + | hostnamectl set-hostname [new host name] | ||
| + | | ||
| + | |||
helpful_ubuntu_commands.1735056321.txt.gz · Last modified: by mike
