Daily life Linux Commands Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 12 Likes Like Report Clear the Terminal : In our daily life, we use to work on Terminal if we are using LINUX. Continuous working on terminal makes the terminal screen full of commands and for removing them and making our screen totally free of character, we often use clear command. Key combination ‘Ctrl+l‘ has the same effect as ‘clear‘ command. So from next time use ctrl+l to clear your Linux Command Line Interface. Note: Since ctrl+l is a key combination, so we can not use it inside a script. If we need to clear screen inside a shell script, we just have to call command ‘clear’. Run command and get back to the directory, together: This is also an amazing hack not known to many people. We may run command no matter what it is and then return back to the current directory. For this, all we need to do is to run the command in parentheses i.e., in between ( and ). For Example : Input : cd /home/shivam/Downloads/ && ls -l Output : -rw-r----- 1 shivam shivam 54272 May 3 18:37 text1.txt -rw-r----- 1 shivam shivam 54272 May 3 18:37 text2.txt -rw-r----- 1 shivam shivam 54272 May 3 18:37 text3.txt Explanation : In the above command it first changed the current directory to Downloads and then list the content of that directory before returning back to the current directory. Shortcut to Directories: You can create a shortcut to frequently accessed directories by adding them to the CDPATH environment variable. So, say If you frequently access "/var/www/html/". Instead of typing "cd /var/www/html", you can add /var/www/ to CDPATH and then you have to type "cd html" only. shivam:~> export CDPATH=$CDPATH:/var/www/ shivam:~> cd html shivam:~:html> Replacing words or characters: If you are working with any text file then to replace every instance of any word say "version" with "story" in myfile.txt, you can use sed command as: # sed 's/version/story/g' myfile.txt Additionally, if you want to ignore character case then you may use gi instead of g as: # sed 's/version/story/gi' myfile.txt Here are some useful shortcuts which you may use while working on terminal: Cursor Movement Control: Ctrl-a: Move cursor to the start of a line Ctrl-e: Move cursor to the end of a line Ctrl-Left/Right: Navigate word by word (may not work in all terminals)Modify Text: Ctrl-w: Delete the whole word to the left of the cursor Ctrl-k: Erase to end of line Ctrl-u: Erase to beginning of line Run top in batch mode: 'top' is a handy utility for monitoring the utilization of your system. It is invoked from the command line and it works by displaying lots of useful information, including CPU and memory usage, the number of running processes, load, the top resource hitters, and other useful bits. By default, top refreshes its report every 3 seconds. Mostly we run 'top' inside the terminal, look on the statistics for a few seconds and then graciously quit and continue our work. Better yet, if we wants to run such a utility only for a given period of time, without any user interaction: There are many possible answers: You could schedule a job via cron. You could run a shell script that runs ps every X seconds Instead of going wild about trying to patch a script, there's a much, much simpler solution: top -b -d 10 -n 3 >> top-file We have top running in batch mode (-b). It's going to refresh every 10 seconds, as specified by the delay (-d) flag, for a total count of 3 iterations (-n). The output will be sent to a file.Here is a screenshots of outut: Duplicate pipe content: 'tee' is a very useful utility that duplicates pipe content. Now, what makes tee really useful is that it can append data to existing files, making it ideal for writing periodic log information to multiple files at once. ps | tee file1 file2 file3 We're sending the output of the ps command to three different files! Or as many as we want. As you can see in the screenshots below, all three files were created at the same time and they all contain the same data. export: The 'export' command is one of the bash shell BUILTINS commands.It has three available command options. In general, it marks an environment variable to be exported with any newly forked child processes and thus it allows a child process to inherit all marked variables. Frequently Used Options with 'export' -p : List of all names that are exported in the current shell -n: Remove names from export list -f : Names are exported as functions Example : command without 'export': $ a = geeksforgeeks.org $ echo $a geeksforgeeks.org $ bash $ echo $a From the above we can see that any new child process forked from a parent process by default does not inherit parent's variables. This is where the export command comes handy. $ a = geeksforgeeks.org $ echo $a geeksforgeeks.org $ export a $ bash $ echo $a geeksforgeeks.org $ On line 3, we now have used the export command to make the variable "a" to be exported when a new child process is created. As a result the variable "a" still contains the string "geeksforgeeks.org" even after a new bash shell was created. basename - Strips directory and suffix from filenames. basename prints NAME with any leading directory components removed. If Suffix is specified, it will also remove a trailing SUFFIX. For example: To get the name of the file present in test folder $ basename test/gfg.txt gfg.txt grep: grep searches files for a given character string or pattern and can replace the string with another. This is one method of searching for files within Linux. grep [option(s)] pattern [file(s)] Search number of files: grep can search any number of files simultaneously. Thus, for example, the following would search the three files file1, file2 and file3 for any line that contains the string GfG grep GfG file1 file2 file3 Search text in all files: To search all text files in the current directory (i.e., the directory in which the user is currently working), if there is a phrase "Linux is" grep 'Linux is' * There are lot of more options which can be tried using grep command. Create Quiz Comment K kartik 12 Improve K kartik 12 Improve Article Tags : Linux-Unix linux-command Explore Getting Started with LinuxIntroduction to Linux Operating System7 min readLINUX Full Form - Lovable Intellect Not Using XP2 min readDifference between Linux and Windows7 min readLinux Distributions6 min readDifference between Unix and Linux6 min readInstallation with LinuxInstallation of Arch Linux in VirtualBox4 min readFedora Linux Operating System5 min readHow to install Ubuntu on VirtualBox?6 min readHow to Install Linux Mint?3 min readInstallation of Kali Linux in Virtual Machine2 min readHow to Install Linux on Windows PowerShell Subsystem?2 min readHow to Find openSUSE Linux Version?2 min readInstallation of CentOS2 min readLinux CommandsLinux Commands15+ min readEssential Unix Commands7 min readFind Command in Linux with Examples7 min readLinux File SystemLinux File System12 min readLinux File Hierarchy Structure5 min readLinux Directory Structure6 min readLinux KernelLinux Kernel4 min readKernel in Operating System3 min readHow Linux Kernel Boots?11 min readDifference between Operating System and Kernel3 min readLinux Kernel Module Programming: Hello World Program7 min readLinux Loadable Kernel Module7 min readLoadable Kernel Module - Linux Device Driver Development4 min readLinux Networking ToolsNetwork configuration and troubleshooting commands in Linux5 min readHow to configure network interfaces in CentOS?5 min readCommand-Line Tools and Utilities For Network Management in Linux8 min readLinux - Network Monitoring Tools4 min readLinux ProcessProcesses in Linux/Unix5 min readHow to Manage Process in Linux4 min readGetting System and Process Information Using C Programming and Shell in Linux2 min readProcess states and Transitions in a UNIX Process4 min readLinux FirewallLINUX Firewall7 min readiptables command in Linux with Examples7 min readHow to Configure your Linux Firewall - 3 Methods12 min readShell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting7 min readUnderstanding Terminal, Console, Shell and Kernel3 min readHow to Create a Shell Script in linux7 min readShell Scripting - Different types of Variables4 min readBash Scripting - Introduction to Bash and Bash Scripting12 min readBash Script - Define Bash Variables and its types12 min readShell Scripting - Shell Variables6 min readBash Script - Difference between Bash Script and Shell Script4 min readShell Scripting - Difference between Korn Shell and Bash shell3 min readShell Scripting - Interactive and Non-Interactive Shell3 min readShell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ4 min readLinux Administrator SystemWhat is Linux System Administration?6 min readBeginner's Guide to Linux System Administration5 min readHow to Monitor System Usage, Outages and Troubleshoot Linux Servers6 min readLinux - Systemd and its Components3 min readBoot Process with Systemd in Linux3 min readHow to Control Systemd Services on Remote Linux Server2 min readHow to Start, Stop and Restart Services in Linux Using systemctl Command9 min read Like