{"id":17383076,"url":"https://github.com/cadedupont/shell-script-archive","last_synced_at":"2025-06-21T13:38:56.776Z","repository":{"id":219988323,"uuid":"750418017","full_name":"cadedupont/shell-script-archive","owner":"cadedupont","description":"Collection of shell scripts written for my own convenience","archived":false,"fork":false,"pushed_at":"2024-11-19T03:30:58.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T20:49:10.223Z","etag":null,"topics":["automation","bash","bash-scripts","shell-scripts"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cadedupont.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-30T15:58:33.000Z","updated_at":"2024-11-19T03:31:01.000Z","dependencies_parsed_at":"2024-12-06T19:12:22.548Z","dependency_job_id":"e7e80e03-1e1b-41a4-86e2-bcafe5580693","html_url":"https://github.com/cadedupont/shell-script-archive","commit_stats":null,"previous_names":["cadedupont/shell-script-archive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cadedupont/shell-script-archive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadedupont%2Fshell-script-archive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadedupont%2Fshell-script-archive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadedupont%2Fshell-script-archive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadedupont%2Fshell-script-archive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cadedupont","download_url":"https://codeload.github.com/cadedupont/shell-script-archive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadedupont%2Fshell-script-archive/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261130727,"owners_count":23114026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","bash","bash-scripts","shell-scripts"],"created_at":"2024-10-16T07:40:30.839Z","updated_at":"2025-06-21T13:38:51.759Z","avatar_url":"https://github.com/cadedupont.png","language":"Shell","readme":"# Shell Script Archive\nThis is an archive of Bash scripts for personal use. A fair deal of configuration will need to be done on your part if you wish to use these scripts yourself.\n\n\u003e [!IMPORTANT]  \n\u003e Access to UARK's server, Turing, now requires access via VPN, meaning you'll need to be connected to the VPN before running the `push.sh` script. Read more [here](https://its.uark.edu/network-access/vpn/index.php).\n\n## Download the Project\nYou can either download the scripts as a ZIP or clone the repository by running the following command in your machine's terminal:\n\n```bash\nfoo@bar:~$ git clone https://github.com/cadedupont/shell-script-archive.git\n```\n\n### Add Scripts to PATH\nIf you want to be able to execute the scripts from any directory on your machine without specifying the exact filepath, you'll need to add the directory to your machine's PATH variable.\n\nThis can be done in your `.bashrc` or `.zshrc` file (depending on which shell your system uses by default- on MacOS, it will likely be ZSH) with the following line:\n\n```bash\nexport PATH=/path/to/scripts:$PATH\n```\n\nThis will append the path to your scripts to the beginning of your PATH, meaning that your operating system will check that directory first when searching for the command you entered into the terminal. Likewise, if you want this directory to be checked last, you can adjust that line like so:\n\n```bash\nexport PATH=$PATH:/path/to/scripts\n```\n\n### Make Scripts Executable\n\nEnsure that these scripts are executable by running the following command in the directory containing the scripts:\n\n```bash\nfoo@bar:/path/to/scripts$ chmod u+x clean.sh push.sh\n```\n\n## [`clean.sh`](clean.sh)\nThis is a script for removing all files in a directory that match a given pattern. This is useful for removing files that are generated by a compiler or interpreter, such as `.class` files in Java or `.pyc` files in Python.\n\nThe script takes a single argument: the directory to clean. If no argument is given, the script will default to the current directory. Below is an example of how to use the script:\n\n```bash\nfoo@bar:~$ clean.sh /path/to/directory\n```\n\nOr, if you want the current directory to be cleaned:\n\n```bash\nfoo@bar:~$ clean.sh\n```\n\n## [`push.sh`](push.sh)\nThis is a script for pushing a backup of my code to the University of Arkansas's Linux server for student use, Turing. As such, only those with access to that server will have the ability to use this script.\n\n#### Generate RSA Key Pair\nBecause this script is intended to run automatically without user interaction, a way to log in to Turing without the use of password entry was needed. The solution to this was generating an RSA key pair, keeping the private key on the machine running the script and a copy of the public key in an `authorized_keys` file on Turing.\n\nTo generate a key pairing, execute the following commands while in the home directory in the terminal. Take note that a .ssh directory may already exist if you have logged on to Turing before, containing a `known_hosts` file:\n\n```bash\nfoo@bar:~$ mkdir .ssh\nfoo@bar:~$ cd .ssh\nfoo@bar:~/.ssh$ ssh-keygen -t rsa\n```\n\nAfter completing these commands, you should now have 2 more files in the `.ssh` directory: `id_rsa` and `id_rsa.pub`. The file with the `.pub` extension is your public key- this is an important distinction as \u003cb\u003eyou should never share the contents of your private key\u003c/b\u003e.\n\nYou now need to send the public key to Turing. This can be done using the `scp` command:\n\n```bash\nfoo@bar:~/.ssh$ scp id_rsa.pub your_username@turing.csce.uark.edu:~/\n```\n\nThis sends a copy of the public key to your home directory on Turing. You now need to add the contents of this key to an `authorized_keys` file in a `~/.ssh` directory on Turing:\n\n```bash\nfoo@bar:~$ ssh your_username@turing.csce.uark.edu\nyour_username@turing:~$ mkdir .ssh\nyour_username@turing:~$ mv id_rsa.pub .ssh\nyour_username@turing:~$ cd .ssh\nyour_username@turing:~/.ssh$ touch authorized_keys\nyour_username@turing:~/.ssh$ cat id_rsa.pub \u003e\u003e authorized_keys\nyour_username@turing:~/.ssh$ rm id_rsa.pub\n```\n\nThis chain of commands will log you on to Turing, make a corresponding `.ssh` directory, move the copy of the public key to that directory, and append the key contents to a file used for authorized key pairings.\n\nFor security reasons, I recommend making your `.ssh` directory on Turing and your local machines only readable, writeable, and executable by the user by running `chmod` in your home directory:\n\n```bash\nyour_username@turing:~/.ssh$ chmod 700 .\n```\n\nThis should be sufficient if you replace all instances of `turing` in the `push` script with `your_username@turing.csce.uark.edu`. If you don't, you'll need to create a `config` file in the `.ssh` directory on your local machine and add the following:\n\n```bash\nHost turing\n  HostName turing.csce.uark.edu\n  IdentitiesOnly yes\n  IdentityFile ~/.ssh/id_rsa\n  User your_username\n```\n\n### Using `cron`\nI have this script automated to run every day at 00:00 with `cron`. You can edit your current `cron` tasks by running the following command:\n\n```bash\nfoo@bar:~$ crontab -e\n```\n\nA new file should open in the `vim` editor. Press `i` to enter insert mode and add the following:\n\n```bash\nPATH=/path/to/scripts:$PATH\n0 0 * * * /path/to/push.sh\n```\n\nPress `esc` to exit insert mode and type `:wq` to save the file and exit `vim`. This script should now run every day at midnight.\n\nIf you wish to change how often the script runs, you can learn more about `cron`'s scheduling syntax [here](https://crontab.guru/).\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadedupont%2Fshell-script-archive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcadedupont%2Fshell-script-archive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadedupont%2Fshell-script-archive/lists"}