Linux commands: 5 Essential Linux Commands to Know

0
106
views
Linux commands

Introduction

The Linux is an open-source operating system considered to be a very popular alternative to Microsoft Windows Operating System. If you opted to go for Linux operating system, then you need to know some essential Linux commands to manage your system run smoothly.

In this article, we’ll discuss the five most common but essential Linux commands along with examples that you can use on any Linux-based System.

So here are the commands:

1. Find Files containing Search Term: Using Grep

To find files containing ‘keywords’, Linux Operating System has a powerful command called grep.

Using the grep command you can search text or search the entire given file for lines containing a match to the given ‘keyword’.

This could either be a strings or words.

Examples of grep Linux commands:

1. Search the “telcocast” word in the file /etc/passwd file

root@Linux-One:~# grep telcocast/etc/passwd
telcocast:x:1000:1000:telcocast,,,:/home/telcocast:/bin/bash
root@Linux-One:~#

2. Search the keyword pattern in the multiple files.

root@Linux-One:~# grep telcocast/etc/passwd /etc/connect/etc/gconnect
/etc/passwd:telcocast:x:1000:1000:telcocast,,,:/home/telcocast:/bin/bash
/etc/gconnect:telcocast:$9$DdsadfdsvefvKp0DG6re:18950:0:88888:7:::/etc/gconnect:adm:*::syslog,telcocast
/etc/gconnect:cdrom:*::telcocast
/etc/gconnect:sudo:*::telcocast
/etc/gconnect:dip:*::telcocast
root@Linux-One:~#

2. Sudo Command:

Sudo is a command that allows users to run programs with the security privileges of another user, by default the superuser. It works both on Unix and Linux Based Operating System.

Examples of Sudo Command:

1. To switch to full root mode:

sudo -s -H

2. To switch to root mode:

sudo -s

3. Display disk space Usage

To display disk space Usage on Linux, simply type in this command:

df -Th

4. Clear the Command Shell Window on Linux

To clear the command shell windows on Linux, simply type in this command:

clear or CTRL + L

5. Viewing Linux Log files “Live”

The below command will give you a live scrolling view of the log file. The new lines are automatically added to the end on your console screen.

tail -f /path/xyzfile.log

To exit use: CTRL + C

LEAVE A REPLY

Please enter your comment!
Please enter your name here