The Linux Swiss army knife
Commands that will make you forget the GUI

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.
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0In 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.

Time the machine has been running
The
$ uptime
Show File system structure
The
$ man hier
Display disk usage information
This command shows the disk usage information.
$ df -k
Display information about the CPU
This command shows the CPU usage information.
$ lscpu
Display a calendar with the current day highlighted
This command displays a simple calendar.
$ cal
Display Bandwidth usage
I love this utility; it is handy to know what is happening on your computer and where it is connecting to.
$ apt-get install iftop
$ iftop
List network interfaces
This command shows the network interfaces with the “ethernet” name.
$ lspci | egrep -i 'network|ethernet'
Display information about your kernel release
$ uname -a
Display System Hardware information
This command display a lot of information about your Hardware.
$ sudo lshw
If you prefer the short version in HTML format:
$ sudo lshw -html > systemInfo.html
A trick, in the command console, you can display the result in the language of your choice with the following commands:
$ export LANG=en_US.UTF-8
$ export LANGUAGE=enSystem admin
Reboot the system
$ sudo rebootShutdown the system at a specific time
$ sudo shutdown -h 19:05 "Some message..."Start/Stop/Restart a service
$ sudo systemctl start serviceName
$ sudo systemctl stop serviceName
$ sudo systemctl restart serviceNameChecking a service status
$ sudo systemctl status serviceNameEnabling/Disabling a service to run at boot time
$ sudo systemctl enable serviceName
$ sudo systemctl disable serviceNameIncreasing 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
$ sudo swapoff -a2. Resize the swap to 4GB
$ sudo dd if=/dev/zero of=/swapfile bs=1G count=4if: input file, of output file, bs: block size
3. Make the file usable as a swap
$ sudo mkswap /swapfile4. Activate the swap file
$ sudo swapon /swapfileSchedule 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
$ crontab -l//00 * * * * nameOfTheCommandToExecuteCron job every hour.
2. Edit the crontab
$ crontab -e
Create a temporary aliase
An easy way to save time is to create an aliased for the most used commands.
#alias [name]="[command]"
$ alias dir="ls -la"
Media
Mute volume
$ amixer set Master muteclear

Find duplicate files based on the MD5 hash
$ find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 | cut -c 35-
Convert camelCase
With this command, you can convert the contents of a file to lowercase.
$ sed -e 's/\(.*\)/\L\1/' hello.txt > output.txt
Find files greater between X and Y

Find all files which are accessed N days back
$ find / -atime 2
Find modifies files in the last N minutes
$ find / -mmin -1
Various
With this utility, you can convert text to json format.
$ sudo apt-get install jshon
$ echo '{"name": "Kesk","surname":"norem"}' | jshon 
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
$ sudo apt-get install greed
$ greed
Use the arrow keys to eat as many digits as possible in any direction.
Pacman
$ sudo apt-get install pacman4console
$ pacman4console
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!
