A list of some important Linux commands part 1

This article is all about some important Linux commands part 1 with examples. Here we learn many of the commands such how to add a local user, delete local user, grant file permissions to a file, change the group ownership of a file, adding a new group, commands for information gathering about the operating system, commands for creating files and folders, commands for change ownership of a file and so on. Generally, all commands are work on all the Linux distributions the same as given below. No further change is done in these commands to do so work on any of the Linux distribution which is present on the internet. So here we learn how to execute these given commands on our Linux operating system with ease.

important command for linux part 1

adduser

The adduser command is used to add a new user to the system. For example to add a new user named Satish, execute the following command:

[email protected]:~# adduser satish
Adding user `satish' ...
Adding new group `satish' (1004) ...
Adding new user `satish' (1003) with group `satish' ...
Creating home directory `/home/satish' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:

Have you ever heard about routing protocols? I know I am talking off the topic but if you want to know about how to configure static routing on a router then here is our guide on it also if you want to configure switches then click here

addgroup

The addgroup command is used to add a new group to a system. For example to add a group named Satish, execute the following command:

[email protected]:~# addgroup satish
Adding group `satish' (GID 1004) ...
Done.

arch

The arch command is used to print the architecture of the machine. For example:

[email protected]:~# arch
i686

Here i686 is the architecture of the machine on which Linux is installed.

cal/ncal

The cal and ncal both commands are used to display a calendar on the screen as an output, but cal command displays the calendar in a horizontal manner and ncal command displays the calendar in a vertical manner. For example:

This is the result of cal command that is given below.

[email protected]:~# cal
July 2017
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

This is the result of ncal command that is given below,

[email protected]:~# ncal
July 2017
Su 2 9 16 23 30
Mo 3 10 17 24 31
Tu 4 11 18 25
We 5 12 19 26
Th 6 13 20 27
Fr 7 14 21 28
Sa 1 8 15 22 29

cat

The cat command is used to join two files together, and print the data of these files on the standard output. It means this command prints the information which is provided to it, whether in the standard input form or in the form of a file. For example to print the output of a.txt file, execute the following command:

[email protected]:~# cat a.txt
Hi..what are you doing?

cd

The cd command is used to change the present working directory(PWD) of a user. For example, to go to the music directory from the root directory, execute the following command:

[email protected]:~# cd Music
[email protected]:~/Music#

chgrp

The chgrp command is used to change the group ownership of a file. In this command the first argument will be a new group name and the second argument will be the name of the file. For example, to change the group ownership of a.txt file to root, execute the following command.

[email protected]:~# chgrp root a.txt

chmod

The chmod command is used to change access permissions of a file. You can give permission to a file using the numeric method and alphabetic method. Here r stands for reading permission, w stands for writing permission, and x stands for execute permission. We explain this command in detail in my earlier articles. stay tuned

[email protected]:~# chmod 777 rahul.txt
[email protected]:~# chmod rwx satish.txt

chown

The chown command is used to change the ownership and group of a file. For example, if you want to change the ownership of file a.txt to root and want to set its group as root, then execute the following command:

[email protected]:~# chown root:root a.txt

cksum

The cksum command is used to prints the CRC checksum and byte count for the input file. For example to print the CRC checksum and byte count for a.txt file, execute the following command:

[email protected]:~# cksum a.txt
1226195471 17 a.txt

Want to send some important files between two computers but you can’t because both the computers are present at different locations. But now it’s easier than ever using Teamviewer software want to know how then click here.

clear

The clear command is used to clear the terminal screen.

[email protected]:~# clear

cmp

The cmp command is used for a byte-by-byte comparison of two files. For example, to compare a.txt and b.txt file, execute the following command:

[email protected]:~# cmp a.txt b.txt
a.txt b.txt differ: byte 2, line 1

Here, instead of a.txt and b.txt, you can use your file name.

comm

The comm command is used to compare two sorted files line-by-line. For example, if file1 contains numbers 1 to 4 and file2 contains number 3 to 6 then on executing the comm command you will get this:

[email protected]:~# comm a.txt b.txt
1
2
3
4
5
6

Here, a.txt and b.txt will be your file1 and file2 name.

cp

The cp command is used to copy files and directories. from one place to another place example given below.

[email protected]:~# ls
a.txt Desktop Documents Downloads Music Pictures Public Templates Videos
[email protected]:~# cp a.txt Desktop/
[email protected]:~# cd Desktop/
[email protected]:~/Desktop# ls
a.txt rahul
[email protected]:~/Desktop#

csplit

The csplit command is used to split a file into sections determined by context lines.

[email protected]:~# csplit a.txt 1 5 10
0
38
76
24

The output of this command is shown by executing ls command on your system which is given below.

[email protected]:~# ls
a.txt Desktop Documents Downloads Music Pictures Public Templates Videos xx00 xx01 xx02 xx03

date

The date command is used to show the systems date and time.

[email protected]:~# date
Thu Jul 13 22:14:16 IST 2017

THAT’S IT

Remaining important commands are published into second part. Comment your thoughts.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: