Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tocic/scripts

Useful bash scripts for Linux
https://github.com/tocic/scripts

archlinux bash linux shell

Last synced: 23 days ago
JSON representation

Useful bash scripts for Linux

Awesome Lists containing this project

README

        

= scripts
:source-highlighter: highlight.js
:repo: https://github.com/tocic/scripts

ifdef::env-github[]
image:https://img.shields.io/github/v/release/tocic/scripts?display_name=release&logo=semantic-release[GitHub release,
link={repo}/releases/latest]
image:https://img.shields.io/github/license/tocic/scripts?logo=opensourceinitiative[license,link=UNLICENSE.txt]
endif::[]

Collection of useful bash scripts for Linux.

[source,bash]
----
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
----

== Installation

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+`:
+
[source,bash]
----
wget https://raw.githubusercontent.com/tocic/scripts/main/common/create_tarball
----

** via `+curl+`:
+
[source,bash]
----
curl -O https://raw.githubusercontent.com/tocic/scripts/main/common/create_tarball
----

--

* for all the scripts in the category/directory `+common+`:
+
--

** via `+subversion+`:
+
[source,bash,subs="attributes+"]
----
git svn clone {repo}/trunk/common
----

** via third-party services:

*** https://download-directory.github.io/?url={repo}/tree/main/common

*** https://minhaskamal.github.io/DownGit/#/home?url={repo}/tree/main/common

+
NOTE: These 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 {repo}/releases[the Releases page].

TIP: Since https://git-scm.com/docs/index-format#_index_entry[`+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+`.

[source,bash]
----
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 https://archlinux.org/packages[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 https://wiki.archlinux.org/title/Environment_variables#Defining_variables[
add the script's directory path to the PATH variable] or place the script itself into `+/usr/local/bin+`, for instance.

== Usage

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
[%collapsible]
====

[cols="<2s,^1,<3"]
|===
^|Script ^|Category ^|Description

|link:common/backup_home[backup_home]
|link:common/[common]
|Backup the home directory to the borg archive.

|link:common/browse_processes_and_threads[browse_processes_and_threads]
|link:common/[common]
|Browse processes and threads.

|link:common/change_keyboard_backlight[change_keyboard_backlight]
|link:common/[common]
|Increase/decrease keyboard backlight.

|link:common/create_tarball[create_tarball]
|link:common/[common]
|Create an optionally compressed tar archive.

|link:common/detach[detach]
|link:common/[common]
|Run the command detached from the terminal.

|link:common/display_process_info[display_process_info]
|link:common/[common]
|Display info about the process.

|link:common/extract_tarball[extract_tarball]
|link:common/[common]
|Extract files from an optionally compressed tar archive.

|link:common/generate_ssh_keys[generate_ssh_keys]
|link:common/[common]
|Generate an SSH key pair.

|link:common/list_script_dependencies[list_script_dependencies]
|link:common/[common]
|List dependencies of the script.

|link:laptop/check_battery[check_battery]
|link:laptop/[laptop]
|Display the battery information.

|link:laptop/check_laptop_mode[check_laptop_mode]
|link:laptop/[laptop]
|Check if the laptop is plugged into AC power.

|link:laptop/toggle_touchpad[toggle_touchpad]
|link:laptop/[laptop], link:X11/[X11]
|Turn off/on the touchpad.

|link:pacman/AUR/clean_aur[clean_aur]
|link:pacman/AUR/[AUR], link:pacman/[pacman]
|Clean git repositories of AUR packages.

|link:pacman/AUR/rebuild_aur[rebuild_aur]
|link:pacman/AUR/[AUR], link:pacman/[pacman]
|Rebuild and reinstall AUR packages.

|link:pacman/AUR/update_aur[update_aur]
|link:pacman/AUR/[AUR], link:pacman/[pacman]
|Update and install AUR packages.

|link:pacman/backup_packages[backup_packages]
|link:pacman/[pacman]
|Backup the names of installed packages.

|link:pacman/browse_packages[browse_packages]
|link:pacman/[pacman]
|Browse installed packages along with info about them.

|link:pacman/list_modified_backup_files[list_modified_backup_files]
|link:pacman/[pacman]
|List backup files that were modified.

|link:pacman/list_orphan_packages[list_orphan_packages]
|link:pacman/[pacman]
|List dependency packages that are no longer required by any installed package.

|link:pacman/list_packages_by_date[list_packages_by_date]
|link:pacman/[pacman]
|List packages sorted by installation date.

|link:pacman/list_packages_by_size[list_packages_by_size]
|link:pacman/[pacman]
|List packages sorted by installation size.

|link:X11/translate_selection[translate_selection]
|link:X11/[X11]
|Translate the selected text into the specified language.

|link:X11/turn_off_monitor[turn_off_monitor]
|link:X11/[X11]
|Turn off the monitor.
|===

====

== Contribution

Feel free to post bug reports, questions, and feature requests at {repo}/issues.
PRs are also welcome, but try to stick to https://google.github.io/styleguide/shellguide.html[the Google-based code
style] established in the existing scripts.