The Linux operating system is more than just a desktop OS. It’s an adaptable and versatile toolbox of utilities and tools.
As we have covered in previous posts, the command line utility is perhaps one of the most useful features in Linux.
You can think of operating out of the GUI as driving automatic, and out of the command line as driving stick shift 🚗⚙️. Any car person can tell you the difference.
Let’s see what the command line can do for you and how it can help streamline your daily computing routine.
To name a few, the Linux CLI can do the following
Automate Tasks
Schedule Services using Cron
Manage Your Network
Use SSH to Securely Connect To Remote Systems
Increase Productivity
Use the Command Line to Automate Tasks
If you’re looking to automate tasks, you might be interested in automating aspects of your computing routine through the CLI.
For instance, you might want to set up a script that automatically logs in to a system on a certain schedule and performs a task. Or one that automatically backs up some files and creates a week’s worth of archives. You can also set up scripts to perform daily tasks such as checking for software updates, or performing maintenance tasks, such as clearing old logs, or removing old backups.
Manage System Services Using Cron
Another use for the command line is to manage system services using cron. Cron is a system service scheduler that lets you schedule commands to run at certain intervals, such as once per day, once per week, or once per month. You can specify the time in the future, or the current time. Taking the backup use case mentioned above, you can run0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
This would run a backup in the form of a tarball at 5:00 UTC every Monday.
Furthermore, you can run the command line that uses cron from a script or from a script in your automation workflow.
Secure Your Linux Network
A great Security use case for the command line is managing the network.
Many of the tools available in Linux can be used from the command line to manage network settings, such as the firewall. For example, you can quickly check the current settings of the firewall using the firewallconfig
command. You can set up rules to allow or deny certain traffic or alter the priority of traffic. All of this and more is possible with the powerful iptables utility.
It be like that sometimes
Use SSH to Securely Connect To Remote Systems
Another important use of the command line is to securely connect to remote systems using SSH.
SSH is a secure, encrypted protocol that allows you to securely connect to other systems or run commands on them.
You can set up SSH on the remote system so that you can easily connect to it using a command such as ssh username@remote-system. There are a few ways to set up SSH on a remote system. One way is to open up a terminal on the remote computer and type the command ssh -t username@remote-system. This will then add an ssh key on the system, to be of use to authenticate on future logins.
Another method is to use an ssh config file
ssh -i ~/.ssh/devkey username@remote-system
You could also use Vagrant and ssh in with vagrant ssh.
For more on Vagrant and utilizing it for Linux, check out my free course on this subject.
Customize Desktop Environment Using Settings
Another of the use cases for the command line is to customize your desktop environment.
For example, you can also use the command line to manage appearance settings for your desktop environment, such as changing the theme, color-way, window borders, and icon theme. This could be done using graphical applications, but the command line is a quick alternative. Additionally, the settings you manage using the command line can be stored in a custom configuration file, such as a bashrc, zshrc so you don’t have to manage everything manually.
Wrapping Up
These are just 5 ways to utilize Linux to its capabilities. For more on the fundamentals, check out my free course Intro to Linux . It’s only an hour long and I believe you will get a lot of value out of it.
Future posts will be written about each of the mentioned use cases for more detail on how to apply each.
Hey Danny! Great blog - I just subscribed.
I really enjoyed the portion pertaining to SSH being a secure access point for your systems & Infra.
Really wanting to gauge if you'd like to have a fun convo on how Teleport approaches encrypted protocols utilizing our identity-based certificates via SSO Integration? Could be a fun chat especially entering 2024 - let me know!