Skip to content
/ 42free Public

Shell script for School 42 students to free up disk space without losing any data. Takes advantage of symbolic links. Includes option to move files back to their original location.

License

Notifications You must be signed in to change notification settings

itislu/42free

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📁  42free  📁

42free is a shell script that helps you manage your limited storage on 42 campuses.

⚙️ 42free supports Linux and macOS.


🚀 Quick Install

bash <(curl -sSL https://raw.githubusercontent.com/itislu/42free/main/install.sh)

GitHub Downloads (all assets, all releases)



🧭 Contents




📌 Overview

No data loss.

  • You will not lose any data by running 42free, it only moves the data to sgoinfre.
    All programs that need the moved directories and files will continue to work normally.

No worries about storage anymore.

  • You only need to run 42free once for every file or directory you want to free the space of.
    From that point onwards, they will accumulate their space outside of your home directory.

Reversable.

  • You can always restore the moved directories and files back to their original location.

Storage limit aware.

  • 42free will detect if moving more files to sgoinfre would go over the allowed storage limit and will warn you.

Easy to use.

  • 42free is designed to be easy to use. You don't have to go to a certain directory or give full paths as arguments. You can use it from any directory and you can pass multiple arguments at once, or none at all. It will detect what you want to do.

You are in control.

  • 42free will prompt you for confirmation if it encounters any unusual situation before doing anything.
    It will not overwrite files without asking you.



🛠️ Installation

To install 42free, you can use one of the following commands:

  • With curl:

    bash <(curl -sSL https://raw.githubusercontent.com/itislu/42free/main/install.sh)
  • With wget:

    bash <(wget -qO- https://raw.githubusercontent.com/itislu/42free/main/install.sh)

This will download the 42free.sh script into a hidden .scripts directory in your home directory.

It will also add an alias 42free to your shells' config files (.bashrc, .zshrc and config.fish) so you can use it from any directory.




👩‍💻 Usage

42free [TARGET]... [OPTION]...
  • Use 42free by running the 42free command in the terminal.

  • 42free will make suggestions what to free if you run it without arguments.


  • Optional: You can specify any amount of files or directories you want to free the space of.
    • The arguments can be given as absolute or relative paths.

    • Example: 42free /path/to/large/directory largeFileInCurDir


Tip

  • Closing all programs first will help to avoid errors during the move.

  • You can pass options anywhere in your command to change the behavior of 42free.

    • Example: 42free -r /path/to/large/directory/in/sgoinfre symLinkInCurDir
Option Description
--restore Use the -r option to move directories and files back to their original location.
--sgoinfre To change the path that 42free considers as your personal sgoinfre directory, run 42free -s.
--max-size To change the warning sizes for the home and sgoinfre directories, run 42free -m.
--info To see the current storage usage of your home and sgoinfre directories, run 42free -i.
--update To update to the latest version, run 42free -u.
--version To see the version information, run 42free -v.
--uninstall To uninstall 42free, run 42free --uninstall.
--help To see the manual, run 42free --help (or 42free -h for the short version).



💡 How it works

42free works by moving files and directories from your home directory to the sgoinfre directory and leaving behind a symbolic link in the original directory.

The allowed space in sgoinfre is usually much higher than in your home directory.

Applications that need the moved files will just follow the symbolic link and access them from sgoinfre.




🌍 Confirmed to work for the following campuses

Campus home sgoinfre OS
🇦🇹 42 Vienna 5GB 30GB Linux
🇩🇪 42 Berlin 5GB 30GB Linux
🇧🇪 19 Brussels 5GB 15GB macOS
🇹🇭 42 Bangkok 15GB 15GB Linux

Confirm your campus here.




🤝 Contributing

  • If this script worked for you and your peers, please let me (and others) know by posting or reacting to already existing posts in the 💬 Discussions page.

  • If the storage layout on your campus is different, you can post in here. A template is already prepared for you 😊
    All confirmed campuses will be added to the 🌍 table above.

  • If you have ideas how 42free could be improved, checkout the 💡 Feedback & Ideas section in the Discussions page and feel free to post there!
    I will see it and respond.

  • If you want to report a bug, please open an Issue or create a Pull Request with a possible fix!
    I'm super grateful for any and all contributions.
    If your changes get merged, you will also be mentioned as a contributor in the release notes!


🏆 BIG thank you to all contributors!

Contributor Contribution
@JonatV Thank you for helping with macOS support!
@Anantiz Thank you for stress testing!
@alexandregv Thank you for showing me how 42 Paris does it!
@loyc12 Thank you for helping to increase compatibility with more campuses!
@kcp2p Thank you for reporting the storage layout at 42 Bangkok!

Also thank you to all my peers at 42 Vienna for the constant feedback! ❤️
@LeaYeh, @ismayilguliyev28, @Rperkmann, @michaela811, @grignetta, @yenthing, @leske42, @ARWChair

And thank you to @Zekao for sparking the idea in the first place.



🐬 Fun fact

The English translation for the French word goinfre (/ɡwɛ̃fʁ/ - pronounced 'gwah(n)-fruh') is "glutton" (definition of glutton: an excessively greedy eater).

Knowing that, goinfre might also be a reference to the character Ford Prefect from The Hitchhiker's Guide to the Galaxy, who is the friend and savior of Arthur.
He is known to be an excessive eater and drinker.


About

Shell script for School 42 students to free up disk space without losing any data. Takes advantage of symbolic links. Includes option to move files back to their original location.

Topics

Resources

License

Stars

Watchers

Forks

Languages