in

LinuxLinux

5 Basic Linux Tips & Tricks Command Line – Interesting Tricks

Linux Tips & Tricks

New to Linux? No problem we are here to explain the basic and fundamental tips and tricks used in the command line. There are many tips and tricks will be very helpful to Linux users. These commands will help you to learn and use Linux functionality easily. The basic Linux command line tips & tricks are added below.

The below tutorial will help you to know some basic tutorials and tips for handling the Linux in the perfect way. These commands need very low time to learn but it contains a lot of efficiencies. Let’s jump into the article.

# History Command:

This is the basic Linux command and you must need to know this basic command to handle the Linux in the best way. This command will help you to track the history of commands and actions that are used in your Linux Pc. The command is “history“.

history

How to use? Copy the above code and paste in terminal

history command
history command

The history command will help you to know the recent commands that have been implemented before in the Linux terminal. If you need any particular time period and then you need to add the particular timestamp with the history command.

History Timestamp
History Timestamp command

The command HISTTIMEFORMAT=”%d/%m/%y %T “history

To apply this Time Format command on history permenantly you just need to use the command ~/.bashrc

  • First run this command – export HISTTIMEFORMAT=”%d/%m/%y %T “
  • Then run this command- source ~/.bashrc

That’s it now the Time format has been added to your every history commands.

Check this too  fping- Best Ping tool for Linux & its Installation on Ubuntu

Explanation of switches and commands:

  • history – GNU History Library in Linux
  • HISTIMEFORMAT – Environmental Variable in Linux
  • %d – Day
  • %m – Month
  • %y – Year
  • %T – Time Stamp in Linux
  • source – in short, send the contents of the file to the shell in Linux
  • .bashrc – is a shell script that BASH runs whenever it is started interactively in Linux.

# DU Command in Linux:

This du command will help you to find out the files that eating your spaces in your disk. This is a one-line command but it is very powerful. The command is:

du -hsx * | sort -rh | head -5

How to use? Copy the above code and paste in terminal

The head -5, which will show you the top 5 files that eating your spaces from your disk.

du command
du command

# Stat file Command in Linux:

This command will help you to know the statics of the particular file.

# stat filename_ext (viz., stat abc.pdf)

How to use? Copy the above code and paste in terminal

We can output the statistics related to a file with the help of stat (output file/fileSystem status) command.

Generate Random Man Pages Command:

This command line is mainly used to generate random man pages in a Linux terminal. The pro-Linux users won’t use this method very much and so it will be helpful for the newbies.

man $(ls /bin | shuf | head -1)

How to use? Copy the above code and paste in terminal

This command will generate the number of random pages using the Linux command line.

Random pages using Man command
Random pages using Man command

# DD Disk speed command in Linux:

This command will help you to know about your disk speed of the Linux pc. This dd is a one-line command which will show you the current speed of the disk.

dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/input.img

Check this too  10+ CronJob Scheduling Task In Linux Using Terminal

How to use? Copy the above code and paste in terminal

Explanation of Switches and Commands:

  • dd – Convert and Copy a file in Linux
  • if=/dev/zero – Read the file and not stdin in Linux
  • of=/tmp/output.img – Write to file and not stdout in Linux
  • bs – Read and Write maximum to M bytes, at one time in Linux
  • count – Copy N input block
  • conv – Convert the file as per comma separated symbol list.
  • rm – Removes files and folder
  • -rf – (-r) removes directories and contents recursively and (-f) Force the removal without prompt.

That’s it, friends, Here we provided the basic commands of Linux which as tips and tricks. If you have any query then feel free to comment us.

What do you think?

1 point
Upvote Downvote
  • Article Length
  • Article Explanantion
  • Image Explanation
  • Commands Clarity
4.8

Summary

In this article, we provided a list of basic Linux commands as the tips and tricks.

Leave a Reply

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

Written by Rachel

I'm Rachel, From Arizona. Am playing the "Content Management" Role in Tec Robust. I started working in TR from Jan 2019. Big Marvel Fan.

Contact me:
tecrobust [@] gmail.com
Sub: Message to Rachel

Usage of ! operator

10 Interesting Usages of “!” Operator in Linux Commands

Best Linux Apps

Install Clam Antivirus for Ubuntu- Best Ubuntu Antivirus