20 Linux Hacks You Should Use

20 Linux Hacks You Should Use

Introduction

“Linux hacks” often refer to resourceful and original ways to use the Linux operating system to do certain tasks, boost productivity, or effectively address issues. These hacks frequently entail leveraging command-line tools, unique scripts, and different Linux features to enhance your productivity or system performance. Linux hacks can range from quick time-saving one-liners to intricate automation scripts and system improvements.

Here are some Linux hacks shown below:

  1. Sharing Server

Using the command below, you can quickly create an HTTP server for sharing in Python 2:

python -m SimpleHTTPServer
  1. Increase Speaker Volume

Increase the speaker’s maximum volume by a predefined percentage (200 in this case):

pactl set-sink-volume 0 200%
  1. Fortune Messages

Send you arbitrary fortunes from your terminal. Implement Ubuntu to:

sudo apt-get install fortune

If you’re using Bash, which is the default on my Linux distributions, add fortune to the final line of your.bashrc file. You may install Cowsay if you love cows. Add the following line at the end of your bashrc file and pipe the output of fortune to cowsay.

fortune | cowsay
  1. Find files common to two directories

Documents with different content. The comm command may be used to locate files in both folders, regardless of their content.

comm -12 <(ls dir1) <(ls dir2)

There will be 0, 1, or 2 leading tabs to distinguish the output, as follows:

files only in dir1
files only in dir2
files in both dirs
  1. Shorten Lengthy Command

Want to condense a long command into a shorter one? Apply aliases

All aliases should be added to your.bashrc file to ensure their permanence. By establishing an alias in our bashrc file, similar to how we used sudo apt-get install to install packages, we can quickly complete the task.

alias install = 'sudo apt-get install'

Following file saving and terminal restart, you can take the following activities:

install cowsay fortune figlet

Rather than typing

sudo apt-get install fortune figlet cowsay

With the syntax alias short-name=’long command,’ you may do it for a variety of commands.

# A lengthy command and the equal symbol (=) are separated by a space. Additionally, some commands have pre-defined aliases, such as la for ls -a. By entering la into your terminal, you may find this out.

  1. Executing several instructions with a single command

For example, Suppose you need to execute multiple commands sequentially.

“;” Because of its usage, this allows several instructions to be executed on a single line, without having to wait for the previous instruction to finish its job to share.

command_1; command_2; command_3
  1. Only if the prior command was successful may numerous commands be run in a single command

Consider a scenario in which you wanted to compile some code and then, assuming the build went OK, execute the make.

For this scenario, the && separator is appropriate. && ensures that a command will only execute after the one before it has completed.

command_1 && command_2

When you run sudo apt update && sudo apt upgrade to upgrade your system, it is an excellent example of this command in action.

  1. Download files

For example, it is necessary to download the file according to the model:

File1 at https://linuxiron.com/files/file1.zip
File2 at https://linuxiron.com/files/file2.zip
Use wget ( comes pre-installed on most distros ) as following

wget Page on inuxiron.com

Crawling and other great automated tasks are both possible with Wget.

  1. Download accelerator

Use axel if you want a reliable download accelerator.

Install Axel with sudo apt-get install.

Employ as follows:

axel –a
  1. Use the command line to get files

This one is quite typical. Using the command line, wget can download files over HTTP, HTTPS, and FTP.

wget file.link

Where file.link is the URL that must be followed to get the file.

  1. Terminate an active command or process

This one is maybe rather obvious. Pressing Ctrl+C will cause a command that is now executing in the foreground to halt so that you can leave it.

  1. Using help with any command

There is a help page for almost every command and command line tool that describes how to use it. Frequently, utilizing help will explain how to use a tool or command.

Just apply it as follows:

command_tool –help
  1. Reading a log file in real-time

Use the tail command with the -f option when you need to analyze the logs while the program is operating.

tail -f path_to_Log

To display only the lines that are important to you, you may also use the standard grep options:

tail -f path_to_log | grep search_term

Option F is another choice you have here. As a result, even if the log file is destroyed, the tail will continue to run. As a result, even if the log file is created again, the tail will continue to log.

  1. Download YouTube videos

Using the youtube-dl package, you may also download YouTube videos directly from the command line. Install the package initially with apt-get or pip.

sudo apt-get install youtube-dl

OR

sudo pip install youtube-dl

Your shipment is prepared for usage. Now you may download videos using it.

youtube-dl Youtube-link
  1. Be a bond

Want to sport the appearance of a tough hacker? Install Hollywood, and your terminal will split to make it appear as though you’re doing a lot of fun stuff.

sudo apt-add-repository ppa:hollywood/ppa
sudo apt-get update
sudo apt-get install hollywood
sudo apt-get install byobu #Used to split your terminal, very useful
Introduce Byobu before Hollywood (Enter "byobu" and "hollywood").
  1. Current Weather

If you want to know the current weather in any city on earth.

Simply type: in your terminal.
curl http://wttr.in/your_city_name

The following three days’ weather was then tastefully presented on your terminal.

  1. Same instruction and simultaneously

Do you want to complete the command that was run at some point yesterday?
Try typing Ctrl- R (recursive search) on the command line and then selecting text and that’s it! No need to press multiple keys to access your recent history.

  1. Change the terminal look and feel

If you wish to change the font sizes, for example, or other elements of your terminal. You are given two choices. dconf or gsettings. Simply said, dconf utilizes a GUI called dconf-editor while gsettings uses the command line. Dconf must first be installed.

sudo apt-get install dconf-tools
dconf-editor
  1. Copy Paste in Linux terminal

Because it relies on Linux distributions and terminal programs, this one is a little hazy. However, generally speaking, these shortcuts should allow you to copy and paste commands: every dconf.

  • Select the text for copying and right-click for paste (works in Putty and other Windows SSH clients)
  • Select the text for copying and middle click (scroll button on the mouse) to paste
  • Ctrl+Shift+C for copy and Ctrl+Shift+V for paste
  1. Enable Scroll lock

In most Linux distributions, the scroll lock is deactivated by default. Even if there isn’t much need for the Scroll Lock in contemporary apps. However, there are still times when we may require it, such as switching the backlight on our backlit keyboards. Activating scroll lock.

xmodmap -e 'add mod3 = Scroll_Lock' link

Final Thoughts

You may quickly and efficiently complete administrative and fundamental chores via the Terminal using Linux hacks. You’ll be able to access functions that aren’t always accessible through a graphical user interface and have more control over your system using it.

To communicate with your machine, especially if you utilize a Virtual Private Server (VPS), you must learn some fundamental Linux commands. Each utility typically has three components: a command name, a flag or option, and a parameter or argument.

We hope that this essay has taught you some fundamental Linux tricks. Please post any queries or recommendations in the comments area below.

Learn about the linux commands by clicking the links below

Echo Command in Linux
How to use ‘nice’ & ‘renice’ commands in Linux
How to Use Kill Commands in Linux
A Beginners Guide to ‘htop’ for Process Management
15 Useful YUM commands in Linux
How to Use the ‘top’ Command in Linux
17 ‘ps’ Command to Monitor Linux Process with Examples
12 Cat Commands in Linux with examples
Archiving and compressing files and directories in Linux
How to run the du command in Linux?
How to backup and restore the Linux system?
Q. Does Linux support gaming?

Video games can be played on GNU/Linux, an operating system. Numerous programs, including Wine, Cedega, and Proton, as well as managers like Lutris and PlayOnLinux, have been developed to run Windows games because the Linux kernel does not natively support many games.

Q. Compared to Windows, is Linux faster?

There are numerous explanations for why Linux is typically faster than Windows. Linux is quite low-weight compared to Windows, which is greasy. Many programs operate in the background on Windows, using up RAM.

Q. Is Linux an arduous course?

If you have some fundamental tech skills and an understanding of operating systems, learning Linux coding isn’t difficult. Learning the fundamental instructions and syntax will be simple for you if you have an analytical and logical mind. You can still study Linux if you’re a complete novice in technology.

Q. What does Linux error code 256 mean?

A value of 256 most likely indicates that the system command is unable to find the binary to run it. Keep in mind that it might not be calling bash and that it might not have configured routes. Retry with the binaries’ full paths! When I call a script that contains the ‘kill’ command in a daemon, I experience the same issue.

Q. Which Linux smartphone is the least expensive?

PinePhone
The company Pine64, which also produces the Pinebook Pro laptop and the Pine64 single-board computer, developed the PinePhone, a reasonably priced Linux phone. The PinePhone’s specifications, functionality, and build quality were all created to be extremely affordable at $149.

Q. What does Linux error code 13 mean?

Permission was denied, EACCES 13. This indicates that we are unable to finish the action because the user lacks the necessary access rights to the resource. When attempting to open an unreadable file, this error may occur. Additionally, it might happen if you try to run a non-executable file.

Leave a Comment

Your email address will not be published. Required fields are marked *