unix swiss army knife
Abstract
Some useful command lines:
Not long ago, I wrote a post with 25 one-command-liners that allow you to do complex things with just one line without using the graphical interface. Now, I will show you a list of commands to turn you into the perfect Linux mechanic.
Note: All commands have been tested on ubuntu 20.04. To execute some commands, you will need administrator permissions.
System information
Check the battery’s status via the terminal
This command outputs a lot of status and statistical information about the battery.
In my case, I’m using ubuntu on a virtualized machine, so it doesn’t show relevant stats, but if you try it on a native installation, it will show you a lot of helpful information.
Screen with the result displayed on the command line.
Time the machine has been running
The uptime
command returns information about how long the system has been running since it was started up the last time.
Screen with the result displayed on the command line.
Show File system structure
The man hier
command shows the description of the file system hierarchy.
Screen with the result displayed on the command line.
Display disk usage information
This command shows the disk usage information.
Screen with the result displayed on the command line.
Display information about the CPU
This command shows the CPU usage information.
Screen with the result displayed on the command line.
Display a calendar with the current day highlighted
This command displays a simple calendar.
Screen with the result displayed on the command line.
Display Bandwidth usage
I love this utility; it is handy to know what is happening on your computer and where it is connecting to.
Screen with the result displayed on the command line.
List network interfaces
This command shows the network interfaces with the “ethernet” name.
Screen with the result displayed on the command line.
Display information about your kernel release
Screen with the result displayed on the command line.
Display System Hardware information
This command display a lot of information about your Hardware.
Screen with the result displayed on the command line.
If you prefer the short version in HTML format:
Screen with the result displayed on the browser.
A trick, in the command console, you can display the result in the language of your choice with the following commands:
System admin
Reboot the system
Shutdown the system at a specific time
Start/Stop/Restart a service
Checking a service status
Enabling/Disabling a service to run at boot time
Increasing the size of the swapfile
The primary function of swap space is to substitute disk space for RAM when RAM fills up and more space is needed. With this command, you can set the size of the swap file.
- Turn off all swap processes
- Resize the swap to 4GB
if: input file, of output file, bs: block size
- Make the file usable as a swap
- Activate the swap file
Schedule jobs with Crontab Command
Cron is a regular background process manager (daemon) that runs processes at regular intervals (for example, every minute, day, week, or month). The processes to be run and the time they should run is specified in the crontab file.
- List schedule jobs
Cron job every hour.
- Edit the crontab
Screen with the result displayed on the command line.
Create a temporary aliase
An easy way to save time is to create an aliased for the most used commands.
Screen with the result displayed on the command line.
Media
Mute volume
Screen with the result displayed on the command line.
Find duplicate files based on the MD5 hash
Screen with the result displayed on the command line.
Convert camelCase
With this command, you can convert the contents of a file to lowercase.
Screen with the result displayed on the command line.
Find files greater between X and Y
Find all files which are accessed N days back
Screen with the result displayed on the command line.
Find modifies files in the last N minutes
Screen with the result displayed on the command line.
Various
With this utility, you can convert text to json format.
Screen with the result displayed on the command line.
Extra
To finish, nothing better than a couple of games to play from the command line. Yes, you can play them from the command line.
Terminal games
Greed
The pacman game in the bash shell.
Use the arrow keys to eat as many digits as possible in any direction.
Resource page for greed 4.2
Eat as much as you can before munching yourself into a corner. When you move in a direction, you erase N grid squares…
Pacman
The Pacman game in the bash shell.
https://github.com/YoctoForBeaglebone/pacman4console
If you have arrived here, I invite you to look at these other 25 Awesome Linux Command One-Liners, where you will find combinations of Linux commands that I am sure will surprise you.
If you liked this post, please consider subscribing to Medium through my profile.
Thank you!