Tips
Copy Files with Rsync
To mirror a directory on a source drive onto a destination drive use the rsync command.
rsync -rtv --progress /source/directory/ /destination/directory
The -r option tells rsync to recurse into directories under the source directory, the -t to preserve times, the -v to be verbose, and the --progress to display transfer progress. The trailing slash on the source directory means copy the contents of the source directory not recreate the directory at the destination. This command does not preserve any attributes other than time. Use the -a option to operate in archive mode preserving all attributes. Add the --checksum or -c option will compare checksums for each file rather than the default of checking file size and modification time to determine changes to a file.
Xorg Keyboard Config
A Desktop Environment will usually have a built in keyboard configuration tool for choosing an alternate keyboard layout. If this tool is not supplied you can create a configuration file to set the layout in X.
The X Window System has a directory where configuration files can be placed to adjust settings. To change keyboard layout, create a file and name it keyboard-layout.conf
and save it to the system xorg.conf.d
directory. Consult the system manual pages for information on where this directory is located.
Section "InputClass" Identifier "KeyboardDefaults" MatchIsKeyboard "on" Option "XkbLayout" "us" Option "XkbVariant" "variant" EndSection
Xorg Monitor Config
To set a monitor resolution manually when Xorg sets a default mode that is not working, create a configuration file to set the correct mode. Use xrandr
to get the list of modes the video card supports. Choose the mode that works and enter it into the configuration file. Save the file to the system xorg.conf.d
directory. Consult the system manual pages for information on where this directory is located.
Section "Screen" Identifier "Screen0" Device "Card0" SubSection "Display" Modes "1024x768" EndSubSection EndSection
Diff Command
Use the diff
command to compare two files for their differences.
diff file1 file2
It is also possible to compare the contents of two directories for the differences.
diff directory1 directory2
If you want to compare subfolders and files too, use the -r option.
diff -r directory1 directory2
Restart Conky
Restart Conky when a click on the desktop hides it. This works on Linux and possibly other systems. Check their kill
and ps
man pages for details.
kill -s USR1 $(ps -C conky -o pid=)
I created an alias named restart-conky
that executes this code.
FreeBSD Update
Keep the system up to date.
freebsd-update fetch
checks for system updates.
freebsd-update install
applies system updates.
pkg update
checks for application updates.
pkg upgrade
applies application updates.
Debian Update
Keep the system up to date.
sudo apt-get update
sudo apt-get upgrade
Plain apt
seems to me to be faster.
sudo apt update
sudo apt upgrade
Instead of combining the commands I use them separately to review the packges that will be upgraded.
OpenBSD Update
Keep the system up to date.
doas syspatch
- Apply errata issued since install.
doas pkg_add -u
- Update installed packages.
doas sysupgrade
- Upgrade system to a new release or a new snapshot.
FuguIta Tips
Command to save changes of running system to persistance area of the usb.
usbfadm -r
Set up the X11 desktop environment.
dtjsetup
Aspell
Check spelling in a text file when your text editor doesn't have an option to check spelling.
aspell check file.txt
Add the option -dont-backup
to prevent ASpell from creating a backup file after checking the spelling.
The -mode=
option can specify the data type the file contains to filter out text that won't be checked such as html tags or urls.
Bash Aliases
Simple text shortcuts for frequently used commands with common options applied to reduce typing. Multiple commands can exist on a line by separating them with a semicolon. To see defined aliases on the system type alias
. It is possible to set temporary aliases on a system using alias name='string'
. Use type alias-name
before naming an alias to make sure you do not choose a word that is already defined as a command.