Collection of useful bash scripts for Linux.
echo "sleep 100" > test.sh && chmod +x test.sh
detach ./test.sh && display_process_info "slee"
create_tarball "test.tar.gz" ./test.sh && extract_tarball "test.tar.gz" .
translate_selection --help && update_aur -h
check_laptop_mode
backup_home --version && backup_packages -V
browse_processes_and_threads
Each script is versioned separately and is released into the public domain, so you can install only the ones you need. You can just copy-paste a script or several scripts from the GitHub UI or use any of the following commands.
-
for the script
common/create_tarball
:-
via
wget
:wget https://raw.githubusercontent.com/tocic/scripts/main/common/create_tarball
-
via
curl
:curl -O https://raw.githubusercontent.com/tocic/scripts/main/common/create_tarball
-
-
for all the scripts in the category/directory
common
:-
via
subversion
:git svn clone https://github.com/tocic/scripts/trunk/common
-
via third-party services:
NoteThese services download files as a ZIP archive. Use any utility like unzip
to extract the files.
-
Alternatively, you can download all the scripts at once on the Releases page.
Tip
|
Since git allows storing regular files only with 755 or 644
permissions, all the scripts are stored with 755 permissions, so you don’t have to chmod +x manually.
But you might consider changing the script’s permissions and/or UID/GID if, for example, you want to remove the ability
to execute the script by all users of the system.
|
Additionally, all dependencies of the executable script must be installed.
You can find them in the script file directly or via the script common/list_script_dependencies
.
list_script_dependencies [--optional] SCRIPT_FILE_PATH
Note
|
Dependency package names are taken from the Arch Linux official repositories.
You can search for the names here to find the equivalent for your package manager.
Most likely, the files from coreutils and util-linux are already installed on your system.
|
Also, for ease of access, it’s recommended to
add the script’s directory path to the PATH variable or place the script itself into /usr/local/bin
, for instance.
Each script has a --help
option that will show you a description of the script and its arguments.
Also, for convenience, descriptions of all the scripts are given below.
Click to see the descriptions
Script | Category | Description |
---|---|---|
Backup the home directory to the borg archive. |
||
Browse processes and threads. |
||
Increase/decrease keyboard backlight. |
||
Create an optionally compressed tar archive. |
||
Run the command detached from the terminal. |
||
Display info about the process. |
||
Extract files from an optionally compressed tar archive. |
||
Generate an SSH key pair. |
||
List dependencies of the script. |
||
Display the battery information. |
||
Check if the laptop is plugged into AC power. |
||
Turn off/on the touchpad. |
||
Clean git repositories of AUR packages. |
||
Rebuild and reinstall AUR packages. |
||
Update and install AUR packages. |
||
Backup the names of installed packages. |
||
Browse installed packages along with info about them. |
||
List backup files that were modified. |
||
List dependency packages that are no longer required by any installed package. |
||
List packages sorted by installation date. |
||
List packages sorted by installation size. |
||
Translate the selected text into the specified language. |
||
Turn off the monitor. |
Feel free to post bug reports, questions, and feature requests at https://github.com/tocic/scripts/issues. PRs are also welcome, but try to stick to the Google-based code style established in the existing scripts.