Programming - useful things
This is more for me than to anyone else, really. Oftentimes I forget important commands, which I will try to put them here. Enjoy.
Git
1. Working with Git:
Before I start putting some Git commands here, I invite you to access Beej's Guide to Git. It is an invaluable resource.
To use Git you can use a GUI or the command-line. Next I'll show some commands, but if you prefer a GUI, for MS-Windows, download GitHub Desktop↗ (suggestion).
• Some basic commands.Check this: How to add an SSH key in GitLab↗.
• Case you deleted a file, and immediately realised it was a mistake?
• Remember that .gitignore will only ignore files *NOT* yet on repository. To remove those files from your repository (but not from your file system) run git rm --cached on them. Also read this thread↗.
• More useful commands:
- Learn Git! Learn the difference between Clone and Fork
- Create a branch in the Command Line Interface (CLI): git checkout -b
- List remotes: git remove -v
- Check changes (useful to check before commit!): git status
GNU/Linux
• Basic commands:
- Adding users: adduser
(this will create 'proper' users, with /home/user folders, etc.) - How to use scp without password: useful for scripting backups, etc. Check this link first↗
- Adding user to sudoers group: (If you want it to be root... careful): usermod -aG sudo
- Host name: hostname
- Kernel info: lsb_release -a
- OS-version: cat /etc/os-release
- CPU info: lscpu
- Memory info: free -h
- Disks: df -h
- Installing things: apt install htop gcc g++ make nmap unzip sysstat plocate net-tools
- ncdu: disk usage (interesting and quick)
- btop: better than htop, same feature