Files
dotfiles/dot_bashrc_help
Faye Lorenz d67a9f0f93 init
2026-02-27 00:02:50 -06:00

988 lines
76 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#! /usr/bin/less -frnS
======================================================================
 ┏━╸╻ ╻╺┳╸┏━┓┏━╸┏┳┓┏━╸ ╻ ╻╻ ╺┳╸╻┏┳┓┏━┓╺┳╸┏━╸ ┏┓ ┏━┓┏━┓╻ ╻┏━┓┏━╸
 ┣╸ ┏╋┛ ┃ ┣┳┛┣╸ ┃┃┃┣╸ ┃ ┃┃ ┃ ┃┃┃┃┣━┫ ┃ ┣╸ ┣┻┓┣━┫┗━┓┣━┫┣┳┛┃
 ┗━╸╹ ╹ ╹ ╹┗╸┗━╸╹ ╹┗━╸ ┗━┛┗━╸ ╹ ╹╹ ╹╹ ╹ ╹ ┗━╸ ╹┗━┛╹ ╹┗━┛╹ ╹╹┗╸┗━╸
 Extreme Ultimate .bashrc File Help
 https://sourceforge.net/projects/ultimate-bashrc/
 bashrcupdate - Update your ~/.bashrc and help file from SourceForge
======================================================================
 Press / to search. Press n or SHIFT-N (backwards) to repeat.
 
 Color Code Legend 

 Title
 Binary or native command
 Alias or function (from the Extreme Ultimate .bashrc file)
 Parameter or options
 Description
 
 Bash Shortcuts 

edit [file] - Edit a file using the default text editor
sudoedit [file] - Edit a file using sudo in a secure method
CTRL-X-E - Edit command in an editor (fc will edit last history)

CTRL-Y - Pastes text from the Bash clipboard
CTRL-U - Cuts text from the cursor to the beginning of the line
CTRL-K - Cuts text from the cursor until the end of the line
CTRL-W or ALT-BACKSPACE - Cut word behind cursor
END CTRL-U or CTRL-Q - Cuts and clears the entire line

CTRL-A or HOME - Move cursor to the beginning of the line
CTRL-E or END - Move cursor to end of line
CTRL-] x - Moves the cursor forward to next occurrence of x
ALT-CTRL-] x - Moves the cursor to previous occurrence of x
CTRL-XX - Toggle between start of line and current cursor position

ALT-T - Swaps the last two words
CTRL-T - Swaps the last two characters
ALT-U - Capitalize all characters in a word after the cursor
ALT-L - Lower case all characters in a word after the cursor
ALT-. - Use the last word of the previous command

history - Shows your command line history
!10 - Runs the command number listed by the history command
Up Arrow or CTRL-P - Previous command in history
Down Arrow or CTRL-N - Next command in history
CTRL-S - Searches the history forward
CTRL-R - Searches the history backward (reverse search)
ALT-R - Undo any changes to a command from history
CTRL-G - Leave the history searching mode without running the command
!! - Repeats the last command (i.e. sudo !!)
!$ - Repeats only the argument from the last command
!* - Repeats all parameters from previous command
!^ - Repeats only the first argument from the last command
!abc - Execute last command in history beginning with abc
!abc:p - Prints last command in history beginning with abc
echo "!!" > [file.sh] - Create a script of the last command
^find^replace - Repeats the last command but replaces text
mv /path/to/file.{txt,xml} - Brackets repeat the command with comma delimited changes
repeat - Repeat a command n times

CTRL-C - Halts the current command
CTRL-Z - Stops the current command (resume with fg in foreground and bg in background)
CTRL-S - Pause terminal output (program will keep running)
CTRL-Q - Release terminal output (after being paused)
CTRL-L - Clear the screen
CTRL-D - Log out

\ - Use at the end of a line to continue a multi-line command
 or use at the beginning of a command to bypass an alias.
CTRL-ALT-E - Expand an alias to it's actual code

To stack multiple commands on one line:
&& - Commands separated by a double ampersand means AND and runs multiple
 commands synchronously with each one running only if the last did not fail.
& - A single ampersand runs multiple commands asynchronously (at the same time).
|| - Commands separated by a double pipe means OR and runs multiple
 commands synchronously with each one running only if the last command failed.
(cd /tmp && ls) - jump to directory, execute command, jump back
 
 Install and Updates 

These aliases detect and use installed package managers on various distros:
has [package] - Show if a package is installed and it's information and version
pkglist - List all installed packages
pkgsearch [package] - Searches for a package
pkginstall [package] - Installs a package
pkgremove [package] - Removes a package
pkgclean [package] - Removes orphans or unused packages
pkgupdate [package] - Updates an installed package
pkgupdateall - Update the system and all packages
 
 Information and Utility 

hlp - Show this help information (also CTRL-H)
a - Show a list of available aliases and functions
alias [alias] - Give the command(s) for an alias

ver - Show the version of the OS and kernel
lsb_release -a or uname -r - Show the current version of the operating system
uname -a - Show kernel config
cat /proc/cpuinfo or cpuinfo - Show CPU information
cat /proc/meminfo - Show memory information
usb - Show the USB device tree
pci - Show the PCI device tree
windowinfo - Select a window for information like geometry, class name, etc.
man [command] - Show manual for a command
mostused - See what command you are using the most
man ascii - ASCII table
apropos - Find word in man pages

type -t [command] or check [command] - Show if a command is aliased, a file, or a built-in command
which [app] - Show which app will be run by default
whereis [app] - Show possible locations of app

date - Show current date and time
today - Show the date only
now - Show the time
cal - Show this month's calendar
cal -3 - Show three months spanning the date
cal 1989 - Show a calendar for a specific year
stopwatch - Stop watch
countdown [time] - Display a countdown timer (requires termdown)
timer [time] - Simple timer function (requires termdown)
filetimenow [file] - Change file accessed and modified time to now
uptime - Show uptime since last start

xdg-open or open - Launch a document/file/url in it's default X application
runfree - Start a program but immediately disown it and detach it from the terminal
glow [file.md] - Markdown viewer (if installed)
glowsafe [file.md] - Markdown viewer without internet (only local)
csvview - View any CSV file in the terminal
json [file] - View JSON files in the terminal with syntax highlighting
rot13 - Rot13 conversion
shellcheck - Check shell script syntax
 
 Files and Folders 

ls - Directory listing
ls -al - Formatted directory listing with hidden files
ls -d */ - List only the directories

ll  - Directory listing: long listing format
labc - Directory listing: alphabetical sort
lx  - Directory listing: sort by extension
lk  - Directory listing: sort by size
lt  - Directory listing: sort by date
lc  - Directory listing: sort by change time
lu  - Directory listing: sort by access time
lw  - Directory listing: wide listing format
lm  - Directory listing: pipe through 'more'
lr  - Directory listing: recursive ls
l.  - Directory listing: only show hidden files
lf  - Directory listing: files only
ltree - Directory listing: tree format
ldir - Directory listing: directories only
new  - Directory listing: recently created/updated files
llfs +10k - List all files larger than a given size

.. - Go back 1 folder
... - Go back 2 folders
.... - Go back 3 folders
..... - Go back 4 folders
..2 - Go back 2 folders
..3 - Go back 3 folders
..4 - Go back 4 folders
..5 - Go back 5 folders
up - go up a specified number of folders

cd [directory] - Change directory
cd or cd ~ - Change to home
cd - - Change into the previous folder
pwd - Shows the directory youre currently in
pwd- - Shows the directory you were previously in
pwdtail - Returns the last 2 fields of the working directory

cp [file1] [file2] - Copy file 1 to file 2
cpp - Copy file with a progress bar
cpg - Copy and go to the directory

mv [file1] [file2] - Rename file 1 to file 2
mv filename.{old,new} - Quickly rename file extension
mvg - Move and go into a directory
mkdir [directory] - Create directory
mkdir -p [a/long/path] - Create directory and all subdirectories
mkdirg - Create and go to the directory
rm [file] - Delete file
rm -f [file] - Force remove file
rm -rf [folder] or rmd [folder] - Remove a directory and all contents
ln -s [file] [link] - Create symbolic link to file
touch [file] - Create or update file
> [file] - Empty a file
cat > [file] - Place standard input into file
cat [file] - Output the contents of file
more [file] - Output the contents of file with paging
less [file] - Output the contents of file with paging
head [file] - Output first 10 lines of file
head -n [count] [file] - Output the first specified number of lines
tail [file] - Output last 10 lines of file
tail -n [count] [file] - Output the last specified number of lines
tail -f [file] - Output contents of file as it grows
diff [file1] [file2] or colordiff - Compare two files

fullpath - Shows full path of file or wildcard
path - List the PATH environment variable directories
pathappend - Add a directory to the end of the path if it exists
pathprepend - Add a directory to the beginning of the path if it exists
df - Show disk usage
du - Show directory space usage
du -sh - Show human readable size in GB
du -s * | sort -n | tail - Show 10 biggest files in the current directory
diskspace - List all folders disk space sorted by largest space
folders - List disk space of immediate folders one level deep
totalsize [directory] - Show the size of the current or specified folder
blocksize [device] - Show the block size of a device
countfiles - Count all files (recursively) in the current folder
tree - Show a folder and file tree
treed - Show a folder tree
trash - Send file(s) to the trash (works with most desktop environments)
trashlist - Display the contents of the trash
trashempty - Empty and permanently delete all the files in the trash
rmempty [directory] - Recursively remove all empty directories
bak [file] - Create a timestamped backup of a file or directory
unbak [file] - Restore a backup using an interactive picker
clone [source] [dest] - Copy files recursively preserving all attributes
clonesync [source] [dest] - Clone and sync directories (deletes files not in source)
shred - Shred a specified file

lsblk - List the available block devices
mount | column -t - Display mounted filesystems in nice layout
mount or m - Mount a file system
umount or um - Unmount a file system
dd if=[file.iso] of=[/dev/usb_drive] status=progress - Make a bootable USB from an ISO file

pandoc [input.md] -o [output.html] - Convert markdown to HTML (Auto-detects extension)
pandoc [input.md] -o [output.pdf] - Convert markdown to PDF (Auto-detects extension)
pandoc -f html -t epub3 -o [output.epub] 'https://somedomain/page' - Convert an HTML page to ebook

home - Go to your home folder
web - Change into Apache web folder
 
 Searching 

find . -type f [search] - Search filenames in the current folder
find . -type f -iname [search] or f [search] - Search filenames in the current folder and ignore case
find . -type f -name *.txt or f *.txt - Search for all text files in the current folder
find . -mtime 10 - Search filenames modified in the last 10 days
find . -cmin -60 - Search filenames modified in the last hour
find . -size +10 -size -50 - Search filenames between 10MB and 50MB
find /dir -type f -name *.mp3 -size +10M -exec rm {} \; - Find specified files and delete them with -exec
find . -type d -iname [search] or finddir [search] - Search directories in the current folder
find . -name '.directory' -type f -delete - Delete Dolphin's hidden .directory files recursively
find [/source/dir] -iname "[files.ext]" -exec cp {} [/target/dir] \; - Copy files from multiple folders into a single folder

findtext [search] - Searches for text in all files in the current folder
findcode [search] - Searches for text in only code files (like HTML, PHP, JS, etc)
fzf - Fuzzy file finder (must be installed)
fzfpreview - Fuzzy file finder with preview
h [search] - Search command line history (also CTRL-S and CTRL-R)
grep [pattern] [files] - Search for pattern in files
grep -r [pattern] [directory] - Search recursively for pattern
[command] | grep [pattern] - Search for pattern in the output of command
pgrep [search] - Find process by name
sed -i 's/[findtext]/[replacetext]/g' [file] - Replace text in a file

locate - Fastest file search using mlocate package
updatedb - Update the mlocate file location database
ulocate - Update the database before locating a file
locate -c or locount - Display the number of matching entries
findcronjob - Interactively search for cron jobs matching time criteria
findservice - Interactively search and manage systemd services
findlog - Shows log files with previews and returns filename (requires fzf)
preview - Shows files in directory with previews for editing (requires fzf)
 
 Graphics Video and Fonts 

xrandr -s 1920x1080 - Change resolution (careful with multi-monitor)
fawkes - Application that distorts images to protect your identity from facial recognition (if installed)

colors - Print a list of colors with escape codes
colors256 - Print a list of all 256 color codes
colors24bit - Test for 24 bit true color in the terminal
whichdisplay - Shows the current display server (X11 or Wayland)
grabvideo - Video capture the Linux desktop (requires ffmpeg)
compressimage [image] - Convert an image to compressed jpg format
sparkbars - Draw spark “EQ” type bars across the terminal
sparkbars | lolcat - Draw spark “EQ” type bars across the terminal in color

chafa [image.gif] - View an image or video in the console (if installed)
jp2a --color [image.jpg] - Create an ASCII version of an image (if installed)
figlet -w [width] -f [font] [text] - Create ASCII text (if installed)
toilet -w [width] -f [font] [text] - Create large ASCII text (if installed)
toiletfont - List the figlet/toilet font directory
toiletfontlist - Show all the fonts available

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.mp4 -ss 1:00 -to 2:00 -c:v h264_nvenc -preset:v slow -profile:v high -rc vbr_hq -b:v 0 -cq 30 -c:a copy -movflags +faststart output.mp4 - Trim Video
ffmpeg -i input.avi -vn -acodec copy output.aac - Extract Audio from Video
ffmpeg -i input.mp4 -c copy -an output.mp4 - Strip Video's Audio
ffmpeg -y -i input.ts -vcodec copy -acodec copy -map 0:v -map 0:a output.mp4 - Convert TS file to MP4
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq [/tmp/output.mpg] - Capture video of Linux desktop
 
 Permissions 

chmod u=rwx,g=rwx,o=rwx [file] - Change permission of file for user, group, other
chmod [octal] [file] - Change permission of file using an octal

Octal order is user/group/other:
4 - read (r)
2 - write (w)
1 - execute (x)

Common permission octals for user/group/other:
000  No permissions
600 rw- --- --- Owner only
644 rw- r-- r-- Owner only write access
660 rw- rw- --- Owner and group only
664 rw- rw- r-- Standard file with world read only
666 rw- rw- rw- Everyone read write access
755 rwx r-x r-x Executable but owner only write access
775 rwx rwx r-x Standard executable or directory (directories require executable)
777 rwx rwx rwx Everyone full access

Permissions in the ls -l (long listing format) output:
Type (- Regular File, d Directory, l Symbolic Link)
|User permissions start here
|| Group permissions start here
|| | World (everyone else) permissions start here
|| | | User owner
|| | | | Group owner
VV V V V V
-rwxr-xr-x 1 root root 1071664 Jan 12 34:56 /usr/bin/bash
^^^  ^
|||  - Permission not set
||x Execute permission
|w Write permission
r Read permission

chmodcalc - Chmod calculator
chmoddirs [octal] - Recursively change only folder permissions
chmodfiles [octal] - Recursively change only file permission
fixuserhome [optional user] - Repairs and sets proper permissions of the home directory
chfix - Recursively set permissions of code files and directories
chmodcopy [source] [target] - Copy permissions from one file to another
chmod +x [file] or mx - make files executable
chmod ug+x ~/{.,}*.sh - Set execute with wildcard including all visible and invisible .sh files
chmod --reference [file1] [file2] - Copy permissions of file 1 to file 2
chmod g+s [folder] - Ensure that new content in the directory will inherit group ownership
ls -lah $(which [command]) - Show the location of a command and it's attributes
 
 Archives and File Compression 

Tar flags:
c - Create archive j - Use bzip2 compression
t - Table of contents k - Do not overwrite
x - Extract T - Files from file
f - Specifies filename w - Ask for confirmation
z - Use gzip compression v - Verbose
p - Preserve pemissions X - Exclude

tar -jcvf [file.tar.bz2] [file1] [file2] - Create a bzip2 archive file of file(s)
tar -jcvpf [file.tar.bz2] [/folder1] [/folder2] - Create bzip2 from folder(s)
pbzip2 --compress --best --force --verbose [files] - Create bzip2 with parallel processors
tar -xvjf [file.tar.bz2] [files] - Extract a bzip2 archive file
tar -jtvf [file.tar.bz2] - View contents of a tar.bz2 file

tar -zcvf [file.tar.gz] [file1] [file2] - Create a gzip archive file of file(s)
tar -zcvpf [file.tar.gz] [/folder1] [/folder2] - Create gzip from folder(s)
tar -I 'pigz --best' -c -f [file.tar.gz] [files] - Create gzip with parallel processors
tar -xvzf [file.tar.gz] [files] - Extract a gzip archive file
tar -ztvf [file.tar.gz] - View contents of a tar.gz file

tar -cvf [file.tar] [files] - Create a tar file
tar -xvf [file.tar] [files] - Extract a tar file
tar -tvf [file.tar] - View contents of a tar file

zip [file.zip] [file1] [file2] - Create a zip file
zip -r [file.zip] [/folder1] [/folder2] - Create a zip from folder(s)
zip -9 -e -r [file.zip] [/folder] - Create zip with password and max compression
unzip [file.zip] -d [/destination] - Unzip a zip archive file to a folder
unzip -l [file.zip] or zipinfo [file.zip] - View contents of a zip file

gzip [file] - Compress file and rename to file.gz
gzip -d [file.gz] - Decompress file

extract - Extract any archive(s)
mkbz2 - Create a bzip2 archive file
unbz2 - Extract a bzip2 archive file
mkgz - Create a gzip archive file
ungz - Extract a gzip archive file
mktar - Create a tar file
untar - Extract a tar file

encrypt - Encrypt a file using OpenSSL AES 256bit Cipher Block Chaining encryption
decrypt - Decrypt a file using OpenSSL AES 256bit Cipher Block Chaining encryption
 
 Process Management and Memory Usage 

top or htop or btm - Monitor processes and system resource usage
cpu - Show the top 10 CPU processes
free - Display amount of free and used memory in MB
activewinpid - Get active X-window process ID (3 second delay)

ps - Display currently active processes
ps aux - Display active processes with more detail
ps aux | sort -nk +4 | tail - Top 10 running processes sorted by memory usage
ps aux | grep -i [process] - Find a process by name
smash - Kill process by name (interactive)
kill [pid] - Kill process with specified pid
kill -9 [pid] - Kill process with specified pid (forced)
kill -15 [pid] - Kill process with specified pid (graceful)
killall [proc] - Kill all processes named proc

jobs -l - show all jobs
fg [number] - Brings job number to foreground
fg - Bring most recent stopped job to foreground
bg - Lists stopped/background jobs, resume stopped job in background
 
 Networking 

curl [http://server.com/file] - Download a file with curl
curl --output [destination_file] [http://server.com/file] - Download with curl to a specified output
wget [file] - Download file with wget
wget -O [destination_file] [http://server.com/file] - Download with wget and specify output
wget -c [file] - Continue stopped download
wget -r [url] - Recursively download files from URL
wget -qO- icanhazip.com - Get your external IP
download [url] - Download a file
youtube-dl -i --no-overwrites --write-description --write-info-json -f 'bestvideo+bestaudio/best' 'https://www.youtube.com/watch?v=' - Download Youtube Video

ping [host] - Test the reachability of a host
fastping - Do not wait for ping interval 1 second (go fast)
ping -i 6O -a [IP] - Set audible alarm for when IP comes online
dig [domain] - Get DNS for domain
dig -x [host] - Reverse lookup host

lsof -i or netwatch - Watch real time network activity
ports - Show open ports
iplocal - Get local IP addresses
ipexternal - Get outside external IP addresses
vim scp://[username@host]/[/path/to/somefile] - remotely edit a file
python -m SimpleHTTPServer - Serve current directory tree at http://HOSTNAME:8000/
net rpc shutdown -I IPAddressOfWindowsPC -U username%password - Remotely shutdown windows machine
sleep 10; alert - Network notify alert for long running commands
 
 SSH Remote Networking 

ssh [user]@[host] - Connect to host as user
ssh -p 22 [user]@[host] - Connect using specified port
ssh -D [port] [user]@[host] - Connect and use bind port
ssh -t [reachable_host] ssh [unreachable_host] - SSH through host in the middle
ssh [user]@[host] -t tmux new-session -A -s main - Connect to host as user and start tmux
sshpass -p '[password]' ssh [user]@[host] - Connect to host as user with password in plaintext
scp [/path/to/local/file] [user]@[host]:[/path/to/remote/directory/] - Copy a local file to a remote host
scp [user]@[host]:[/path/to/remote/file] [/path/to/local/directory/] - Copy a file from a remote host to a local directory
sshfs [name@server:/path/to/folder] [/path/to/mount/point] - Mount file system over SSH
rsync -avzhP [/local/folder/] [user]@[server]:[/remote/folder/] - Sync local to SSH server (one way)
sync2ssh [local] [user@host:port] [remote] - Synchronize files using rsync over SSH

ssh-keygen -t rsa -b 4096 - Generate a new SSH key pair with 4096 bits
ssh-copy-id [user]@[host] - Upload public key for passwordless secure SSH
 
 Restarting 

rebootsafe - reboot safely
rebootforce - force reboot
rebootlater [time] - Schedule the computer to auto reboot
rebootfast - Fast reboot user space without rebooting kernel
logout - Log out the current user
firmwareupdate - Update system firmware

sudo shutdown -r now - reboot immediately
sudo shutdown -P now - power down immediately
sudo shutdown -r 10 - reboot after 10 minutes
sudo shutdown -r 12:34 - reboot after 12 hours and 34 minutes
sudo reboot -f - force reboot
last reboot | head - show last 10 reboots
 
 Compile and Install From Source 

./configure (may not have this)
make
make install
make clean
 
 Configuration 

ebrc - Edit the .bashrc file

sudo nano /etc/fstab - Edit startup configuration
nano /etc/sysctl.conf - Change system security

sudo systemctl restart httpd - Restart Apache
httpd -t or sudo apachectl configtest - Check the Apache configuration for errors
httpd -V - Find apache configuration file(s)
apacheconfig - Edit Apache web server configuration
ngconfig - Edit Nginx web server configuration
mysqld --verbose --help | grep -A 1 "Default options" - Find MySQL configuration file(s)
mysqlconfig - Edit MySQL database configuration
php -r 'echo php_ini_loaded_file() . "\n";' - Find the PHP configuration file
phpconfig - Edit the PHP configuration
phpchecksyntax - Check the syntax of a PHP file for errors
hoststoggle - Toggle the hosts file off and back on

chattr +i /etc/php.ini - Protect a file
chattr -i /etc/php.ini - Unprotect a file

logs - Show all logs in /var/log

sudo cpupower frequency-info - Info about powersaving mode (requires cpupower or linux-cpupower package)
sudo cpupower frequency-set -g performance - Set powersaving mode off for performance
sudo cpupower frequency-set -g powersave - Set powersaving mode on to save power
 
 Modify GRUB Boot Loader 

sudo nano /etc/default/grub
sudo update-grub
 
 Start/Stop/Restart a Service (systemd) 

sudo systemctl start [service] or servicestart - Start a service
sudo systemctl stop [service] or servicestop - Stop a service
sudo systemctl kill [service] or servicekill - Force terminate a service
sudo systemctl restart [service] or servicerestart - Restart a service
sudo systemctl reload [service] or servicereload - Reload the configuration for a service
sudo systemctl status [service] or servicestatus - Show the status of the service
sudo systemctl is-active [service] - Check if a service is running
sudo systemctl enable [service] - Enable a service to run at boot
sudo systemctl is-enabled [service] - Check if a service is configured to start automatically
sudo systemctl --failed or failed - Find what services have failed
sudo systemctl list-units --type=service or servicesall - List all services
services - List all running or failed services

apacherestart - Restart the Apache web server (requires Apache to be installed)
ngrestart - Restart the Nginx web server (requires Nginx to be installed)
 
 Cron Jobs (cronie Package) 

sudo crontab -l - List all cron jobs
sudo -E crontab -e - Edit the crontab file preserving editor environment variables

Each line has five time-and-date fields followed by a command and new line.
The fields are separated by spaces (fields cannot contain spaces).
The five time-and-date fields are as follows:

 Minute (0-59)
 | Hour (0-23, 0 = midnight)
 | | Day (1-31)
 | | | Month (1-12)
 | | | | Weekday (0-6, 0 = Sunday)
 | | | | | Script file or executable
 V V V V V V
 00 00 01 * * /directories/script.sh

The cron log is found here: nano /var/log/cron
More info here: https://help.ubuntu.com/community/CronHowto

Anacron directory locations:
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.weekly
/etc/cron.monthly
 
 Run Commands at Different Times 

nohup [command] & - Run commands after you log out of an ssh session
Example: nohup wget http://server.com/file.zip &

at [time] - Run a linux command at a specific time
Example:
at 10:38 PM Fri
at> echo 'hello'
at> CTRL + D
 
 User Administration 

cut -d: -f1 /etc/passwd - List all users and their information
sudo useradd [user] - Add a new user
sudo userdel -r [user] - Delete an existing user
sudo usermod -l [user] - Change a user's name
sudo chfn [user] - Change the finger information for a user
sudo passwd [user] - Change a user's password
genpw [length] - Generate passwords (optional parameter -s or +s for symbols)
spellcheck [text] - Spell check command line input (requires aspell or hunspell)
usermod -a -G wheel [user] - Make a user an administrator (add to wheel group)
usermod -a -G wheel,developers [user] - Make a user a developer (add to developer group)

w - Shows information about the users currently on the machine and their processes
w [user] - Shows the information about a particular user
whoami - Show who are you logged in as
who - Shows information about users who are currently logged in
users - Shows the login names of the users currently on the system

sudo chsh --shell /bin/bash [user] - Change the default shell for a user
sudo chsh --list-shells - Print the list of shells
 
 Group Administration 

groups - List groups
cut -d: -f1 /etc/group | sort - List all groups
sudo groupadd [group] - Add a new group
sudo groupdel [group] - Delete an existing group
grep -i [group] /etc/group - List all the users in a specified group
id -Gn [user] - List all the groups for a user
find / -group [group] - List all the files owned by a group
 
 Clam AntiVirus 

freshclam - Update clam definitions

clamscan -ir [/var/www/html/]

clamscan --recursive=yes --infected --log=[/tmp/virus_scan.txt] --move=[/tmp/quarantine/]
 --scan-mail=yes --phishing-sigs=yes --phishing-scan-urls=yes [/var/www/html/]

clamscan -ir / > [/tmp/virus_scan.txt]
 
 Rootkit Checks 

To update and run RKHunter:
sudo rkhunter --update
sudo rkhunter --check

RKHunter keeps its log here:
/var/log/rkhunter/rkhunter.log

chkrootkit - Another rootkit check program
 
 Security Check With LinPEASS 

After installing peass, you can usually find it here:
/usr/share/peass/linPEAS/linpeas.sh
 
 Spectre Meltdown Checker 

spectre-meltdown-checker - Check for Spectre Meltdown bugs

For more information see:
https://github.com/speed47/spectre-meltdown-checker
 
 BtrFS File System Utilities 

sudo btrfs fi show or btrcheck - Check status of raid drives
sudo btrfs device stats [/directory] or btrstats - Show device statistics
sudo btrfs scrub start [/directory] or btrscrub - Start a scrub
sudo btrfs scrub cancel [/directory] or btrpause - Cancel or pause a scrub
sudo btrfs scrub resume [/directory] or btrresume - Resume a paused scrub
sudo btrfs scrub status [/directory] or btrstatus - Show status of a scrub
sudo btrfs filesystem defragment -vf [file] or btrdefragfile - Defrag a file
sudo btrfs filesystem defragment -rvf [/directory] or btrdefragdir - Defrag a directory
 
 Tmux Terminal Multiplexer 

Load new session named "main" or attach to this session if it already exists:
tmux a -t main || tmux new -s main
-or- use the alias: tm

tmux detach or tmd or CTRL-b + d - Detach from a Tmux session but leave the session running
tmux ls or tmlist - List all Tmux sessions
tmux list-sessions -F "#{session_name}" - List all Tmux sessions by name only
tmux lsc or tmclients - List all Tmux clients
tmux new -s [session] or tmnew [session] - Create a new session
tmux a -t [session] or tmattach [session] - Attach to a specified Tmux session (-d will detach all other clients)
tmux attach - Attach to an existing Tmux session
tmux rename -t [session] [new_name] or tmrename [session] [new_name] - Rename a Tmux session
tmux kill-session -t [session] or tmkill [session] - Kill a Tmux session
tmux kill-server or tmreset - Kill all Tmux sessions
 
 Tmux Windows/Panes - Use CTRL-b First 

0-9 - Select window by number
c - Create new window
w - List windows
f - Find window
, - Rename window
& - Kill window
l - Toggle last active window
p - Previous window
n - Next window

% or \ - Split a pane into left and right panes
" or - - Split a pane into top and bottom panes
CTRL-o - Swap panes
SHIFT-{ - Move the current pane left
SHIFT-} - Move the current pane right
b - Break off pane to it's own window
z - Toggle zoom a window (great for copy)

q - Show pane numbers
q 0-9 - Select pane by number
x - Close current pane (or use CTRL-D)
! - Close other panes except the current one

PgUp - Scroll one page up and go into scroll mode
[ - Enter scroll mode
q - Quit scroll mode
] - Paste (any text selected is copied in mouse mode)

To copy and paste in Tmux (using vim keybindings):
NOTE: This is set in the ~/tmux.conf file: set-window-option -g mode-keys vi
* Press the CTRL-b and then press [ to enter the copy mode
* If the mouse is enabled, you can just select the text
* If there is no mouse enabled, use the arrow keys for the start position and press CTRL-SPACE
* Use the arrow keys to the end position and press CTRL-w or ALT-w
* To paste, press CTRL-b followed by ]

TIP: When in copy mode, type / to search and n to find next.

Here is a list of all the new keybindings in my .tmux.conf for easy reference:
https://sourceforge.net/projects/ultimate-bashrc/files/support/
| Keybinding | Description |
|------------------|-------------------------------------------------------------|
| CTRL-a | Use either C-a or C-b as the default PREFIX key |
| PREFIX | | Split the window horizontally (keeping the current path) |
| PREFIX \\ | Split the window horizontally (keeping the current path) |
| PREFIX - | Split the window vertically (keeping the current path) |
| PREFIX _ | Split the window vertically (keeping the current path) |
| PREFIX = | Synchronize panes (on/off) |
| PREFIX CTRL-a | Switch windows by pressing C-a twice |
| PREFIX c | Create a new window now opens using the current path |
| PREFIX d | Detach client |
| PREFIX CTRL-d | Choose a client to detach |
| PREFIX CTRL-e | Edit the Tmux configuration file and then reload settings |
| PREFIX g | Split the pane into a grid of 4 panes (horizontal resize) |
| PREFIX G | Split the pane into a grid of 4 panes (vertical resize) |
| PREFIX h | Show the Extreme Ultimate .bashrc help file in a new pane |
| PREFIX CTRL-h | Show the Extreme Ultimate .bashrc README file in a new pane |
| PREFIX j | Join panes (show the numbers with CTRL-w) |
| PREFIX J | Send pane to another pane (show the numbers with CTRL-w) |
| PREFIX CTRL-l | Clear screen and the buffer history |
| PREFIX M | Toggle the mouse on and off |
| PREFIX CTRL-m | Prompt for keyword and open a man page for it in a new pane |
| PREFIX r | Reload the .tmux.conf configuration file |
| PREFIX s | Toggle the status bar on and off |
| PREFIX T | Make the current window the first window |
| PREFIX v | Paste from the top paste buffer |
| PREFIX V | List paste buffers |
| PREFIX CTRL-v | Choose which buffer to paste from |
| PREFIX w | Display visible indicator of each pane |
| PREFIX z | Toggle zoom (make a pane full screen) |
| PREFIX Tab | Switch to the next available window |
| PREFIX Shift-Tab | Switch to the most recently accessed window |
| ENTER | Copy selection to OS clipboard when in copy mode |
| Mouse Selection | Copy selection to OS clipboard (in copy mode, mouse drag) |
 
 Git 

git status --short --branch - Shows a short Git status
git status - Shows full Git status
git pull - Git pull (fetch and merge)
git push - Git push
git add [file] - Git add
git add -p [file] - Git add interactively choose hunks
git commit -m "Commit message" - Git commit
git reset - Git reset specifies a file to un-add (or no file to unstage all)
git log - Git log
git diff - Git diff
git diff --stat - Git diff stat
git diff --cached - Git diff cached
git checkout [branch] - Checkout a branch
git checkout -b [branch] - Create a new branch

gg - Shows a short Git status or if given arguments invokes Git
ggg - Shows full Git status
ggs - Shows a short Git status with branch information
ggp - Git pull (fetch and merge)
ggf - Git fetch
ggm - Git merge
ggpu - Git push
ggr - Git reset specifies a file to un-add (or no file to unstage all)
gga [file] - Git add
ggap [file] - Git add interactively choose hunks
ggac "Commit message" - Git add all files in current path and commit
ggc "Commit message" - Git commit
ggca - Git commit amend
ggl - Git log with improved formatting
ggd - Git diff
ggds - Git diff stat
ggdc - Git diff cached
ggb [branch] - Checkout a branch
ggcb [branch] - Create a new branch
ggst - Git stash
ggpop - Git pop
gitls - Directory listing with Git status shown
lg - If installed, runs LazyGit
ggu - If installed, runs GitUI
gitc - If installed, runs Git Commander
gitt - If installed, runs Tig interface for Git
gitrv - If installed, runs GRV (Git Repository Viewer)
gitundo - If installed, runs Ugit Git Undo

gitalias - Installs or updates many useful Git alias commands
Restart bash to see changes. Visit https://github.com/GitAlias/gitalias for more info

 
 
 Multimedia and Voice 

say [text] - Text to speech
saygreet - Say a greeting using text to speech
sayclipboard - Read the clipboard out loud
yt [url] - Play YouTube videos
ytd [url] - Download a YouTube video with yt-dlp

 
 Text Manipulation 

formattext [text] - Transform text using common string formatting operations
trim [text] - Remove leading and trailing whitespace from a string
fixspaces [text] - Replace multiple spaces, tabs, and underscores with single space
lowercase [text] - Convert a string to lowercase
uppercase [text] - Convert a string to uppercase
capitalize [text] - Capitalize every word in a string
titlecase [text] - Convert to title case (skip small words)
smartquotes [text] - Convert regular quotes to smart quotes
unsmartquotes [text] - Convert smart quotes to regular quotes
reversetext [text] - Reverse the characters in a string
countchars [text] - Count the number of characters in a string
countwords [text] - Count the number of words in a string
startswith [text] [prefix] - Check if a string starts with a specific substring
endswith [text] [suffix] - Check if a string ends with a specific substring
lines [file] [range] - Display specific lines or line ranges from a file
wrap [width] - Wrap text at specified width
unwrap - Remove line wrapping from text
fixfilename [file] - Clean up and standardize file names
replacetext [find] [replace] [file] - Replace text strings in files
 
 Clipboard 

clipboard - View, set, or clear clipboard content (supports piping)
cbshow - Show the contents of the clipboard
trimcb - Trim leading and trailing characters on clipboard
file2cb [file] - Load file contents to clipboard
cb2file [file] - Save clipboard contents to file
file2asc [file] - Compress file to clipboard as base64
asc2file [file] - Extract base64 from clipboard to file
 
 Boot Analysis 

boottime - Show how long it took to boot the system
boottimelist - Show detailed boot time breakdown by service
bootchart - Generate a visual boot time analysis chart as SVG
bootmessages - View kernel messages from the current boot
bootprevious - View kernel messages from the previous boot
booterrors - Show warnings and errors from current boot
bootlist - List available boot sessions with IDs and timestamps
kernelmessages - Show raw kernel ring buffer messages (dmesg)
kernelerrors - Show filtered kernel errors, warnings, and critical issues
checkreboot - Check if the system needs to be rebooted
 
 Scripting Utilities 

ask "question" [Y/N] - Interactive yes/no prompt for scripts
hascommand [command] - Check if a command or alias exists (with caching)
hascommandclear - Clear the hascommand cache after installing software
timeelapsed [date] [message] - Show elapsed time since a given date
runwithfeedback [desc] [cmd] - Run command with visual progress feedback
analyzecode [file] - Analyze a code file to provide statistics
showfunctions [file] - List function names with line numbers from source code
createmenu - Create interactive text picker menu from piped input
 
 Advanced User Management 

createuser - Interactively create, configure, and test a new user
deleteuser [user] - Remove a user from the system
wipeuser [user] - Remove user and all traces including home directory
 
 SSL and Security 

sslcheck [domain] - Check SSL certificate expiration with color-coded urgency
flushcache - Clear RAM memory cache, buffer and swap space
flushdns - Clear DNS cache to refresh domain name data
ss -tuln - Show listening TCP and UDP ports
ss -p - Show process using each socket
fail2ban-client status - Show fail2ban status (if installed)
last -a - Show last logged in users with hostname
lastb - Show bad login attempts
 
 Additional Archive Formats 

mkzst [archive.tar.zst] [files] - Create a zstd compressed archive
unzst [archive.tar.zst] - Extract a zstd compressed archive
mkxz [archive.tar.xz] [files] - Create an xz compressed archive
unxz [archive.tar.xz] - Extract an xz compressed archive
mk7z [archive.7z] [files] - Create a 7z archive with ultra compression
un7z [archive.7z] - Extract a 7z archive
mkiso [archive.iso] [files] - Create an ISO image
uniso [archive.iso] - Extract an ISO image
mkzip [archive.zip] [files] - Create a zip with maximum compression
 
 Common Linux Commands 

System Information:
hostnamectl - Show or set system hostname and related settings
timedatectl - Show or set system time and date settings
localectl - Show or set system locale and keyboard settings
dmidecode - Show hardware information from BIOS (requires sudo)
lscpu - Display CPU architecture information
lsmem - List memory ranges and their online status
lspci -v - List all PCI devices with details
lsusb -v - List all USB devices with details
hdparm -I [/dev/sda] - Show detailed disk information
smartctl -a [/dev/sda] - Show SMART disk health data

Disk and Filesystem:
blkid - Show block device attributes (UUID, type, label)
fdisk -l - List all disk partitions (requires sudo)
parted -l - List partitions on all devices (requires sudo)
lsblk -f - List block devices with filesystem info
findmnt - List all mounted filesystems in tree format
findmnt -t ext4,btrfs - List only specific filesystem types
iostat - Show CPU and disk I/O statistics
iotop - Top-like I/O monitor (requires sudo)
fstrim -av - Trim all mounted filesystems (SSD optimization)
sync - Flush filesystem buffers to disk

Network Diagnostics:
ip a - Show all network interfaces and IP addresses
ip r - Show routing table
ip link - Show network interface status
ss -tuln - Show listening ports (replaces netstat)
nmcli device status - Show NetworkManager device status
nmcli connection show - Show NetworkManager connections
traceroute [host] - Trace packet route to host
mtr [host] - Combines ping and traceroute (interactive)
nmap -sn [192.168.1.0/24] - Scan network for live hosts
arp -a - Show ARP cache (MAC addresses on local network)
netstat -i - Show network interface statistics
vnstat - Show network traffic statistics over time
dig +short [domain] - Quick DNS lookup
host [domain] - Simple DNS lookup
nslookup [domain] - Query DNS servers interactively

Process and System Monitoring:
strace -p [pid] - Trace system calls of a running process
ltrace -p [pid] - Trace library calls of a running process
lsof -p [pid] - List files opened by a process
lsof +D [directory] - Find processes using files in directory
fuser -v [file] - Show processes using a file or filesystem
pmap [pid] - Show memory map of a process
watch -n 1 [command] - Run command every second and display output
timeout [seconds] [command] - Run command with time limit
time [command] - Measure execution time of a command
nice -n 19 [command] - Run command with lowest priority
renice -n 10 -p [pid] - Change priority of running process
nproc - Show number of available CPU cores

Journald Logs:
journalctl -xe - Show recent logs with explanations
journalctl -f - Follow new log entries (like tail -f)
journalctl -u [service] - Show logs for specific service
journalctl --since "1 hour ago" - Show logs from last hour
journalctl -p err - Show only error messages
journalctl -b -1 - Show logs from previous boot
journalctl --disk-usage - Show journal disk usage
cleansystemlogs [days] - Clear log entries older than specified days

Miscellaneous:
xdg-mime query default [mimetype] - Show default app for file type
xdg-mime query filetype [file] - Show MIME type of file
xdg-settings get default-web-browser - Show default web browser
file [file] - Determine file type
stat [file] - Show detailed file information
namei -l [path] - Show path resolution with permissions
getfacl [file] - Show file access control lists
setfacl -m u:[user]:rwx [file] - Set ACL permissions
lsattr [file] - List file attributes (immutable, etc)
chattr +i [file] - Make file immutable (even root cannot modify)
chattr -i [file] - Remove immutable attribute
column -t - Format input into aligned columns
printf - Formatted printing (more control than echo)
seq [start] [end] - Generate sequence of numbers
shuf - Randomly shuffle lines of input
sort -u - Sort and remove duplicates
sort -h - Sort human-readable numbers (1K, 2M, 3G)
uniq -c - Count occurrences of unique lines
cut -d: -f1 - Extract first field using : delimiter
tr 'a-z' 'A-Z' - Translate lowercase to uppercase
xargs -I {} [cmd] - Build command from piped input
tee [file] - Write output to file and stdout
env - Show all environment variables
printenv [VAR] - Print specific environment variable
export [VAR=value] - Set environment variable
source [file] or . [file] - Execute commands from file in current shell
eval [string] - Evaluate string as shell command
exec [command] - Replace shell with command