13 Tips to Boost Linux Productivity - GeeksforGeeks

16 Mar, 2020
We all know that Linux is a powerful operating system, which is an all-time favorite of Developers, Hackers, and Programmers. Today in this post you will learn some of the powerful command-line tips and tricks to enhance your Linux computing skills. You may be knowing some of these tricks but still, there is never an end to learning.
1) The ‘!’ Command
How many times have you decided to re-use the command you just enter into the terminal, and then used up and down arrow keys to navigate through command history. But this simple ‘!’ will help you to take command of your terminal by executing the previous command quickly!
Syntax:
!{command keyword}
Example: If you have used ls-l earlier, then by simply writing !ls will execute previous command again.
2) The ‘!!’ Command
It works similar to the previous tip except it doesn’t need the {previous command} simple insert ‘!!’ and your terminal will execute the previous command automatically.
Syntax:
!!
Example: If you have used ls-l earlier, then simply by inserting !! will automatically execute ls-l again.
3) Checking RAM, CPU and Memory usage in Linux
In order to check your device’s performance statistics, you need to install HTOP. HTOP is a powerful GUI tool that helps you to check all background activities, CPU usage, RAM, Process ID’S and the Uptime of the device. To install HTOP, use the following command:
sudo apt install htop
4) To Gain History of All Previous Commands
How about having a list of all your histories & commands performed and time you spent on the Terminal. Following commands will let you do that easily using,
export HISTIMEFORMAT="%t"
source ~/.bashrc
history
5) Netstat’s Useful Option
Displaying the program which is listening on TCP/IP port in windows.
netstat -aon|more
6) Changing Your Host Name in Linux
The hostname can also be considered as a label assigned to your device through which your machine gets identified in a network. But there are various ways by which you can change your hostname.
Step 1: Check your host name by typing; hostnamectl
Step 2: Now choose desired host name here we are changing the host name from kali to sankalp by typing; sudo hostnamectl set-hostname sankalp
7) Process Statistics and Performance Utility
Top is a great utility that helps to get a lot of information about the performance of your device, memory usage, Processes running, Background services and what not!
Syntax:
top
8) To Enable Night Light #ubuntu From cli
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
9) Scheduling the Task
cron command is a tool provided by UNIX OS. Its primary job is to schedule the tasks at a defined time. It schedules job as per predefined date and time and runs in the background. It is used to perform repetitive tasks.
To run crontab:
crontab -e
To un-schedule all crontab tasks
sudo crontab -u -e
10) Giving Aliases for Commands
Linux provides a great functionality of providing aliases to certain commands so that we don’t have to type long commands again and again.
Syntax:
alias {short name}={command name}
Example:
alias clr=clear
11) Free Command
The free command is used to get a summary of your memory usage of both the Main memory as well as swap memory.
Without using -h
free
By using -h we get human friendly result
 free -h
12) To Change Timezone
Method: Remove localtime file
rm -f /etc/localtime
Create symbolic link from your City in folder(/usr/share/zoneinfo/)
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
13) Finding Large Files
Example 1 – Find files with more than 200 megabyte size in current directory.
find ./ -type f -size +200000k
Example 2 – Find files with more than 500 kilobyte size in etc directory.
find /etc -type f -size +500k
Example 3 – Finding and removing files more than 200 megabyte in /var:
find /var -type f -size +2000000k -exec rm -f {} \;
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
tar command in Linux with examples
SORT command in Linux/Unix with examples
curl command in Linux with Examples
'crontab' in Linux with Examples
UDP Server-Client implementation in C
diff command in Linux with examples
Cat command in Linux with examples
Tail command in Linux with examples
tee command in Linux with examples