Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Linux basic commands

 


By Koushiq_Murad on March 22, 2021 

Linux  basic command

ls: To see the list of directories / folders (List the current directory content.)

cd: to change directory / folder (Use this to change current Directory.)

cat: This command is used to prompt and create a new file. This command is similar to DOS’s copycon command (can be used to display file content on to the screen, copy and combine text files.)

history: to see the list of commands used (use this to show all executed commands list on the screen.)

chmod: to change the permission of the file (use chomod to change file permission.)

chown: to change the owner of the file (use this to change file owner.)

clear: (clear screen for fresh start (use this to clear screen for fresh start.)

df: To view disk space (It display used and available disk space.)

date: To know the date and time of the system (display current system date and time)

du: To display the file size (It display space taken by each file.)

file: It identifies the data type in any file (it recognize type of data in any file.)

find: search any word in the file (search any term in file.)

man: help for specific commands (display help for specific command.)

cp: to copy files or folders (can be used to copy files and folders)

mv: to move a file or folder (it can be used to rename or move files and dir.)

mkdir: to create a new directory / folder (can be used to create new directory.)

less: to view the file content page by page (can be used to see file content page by page.)

su: to change the user (can be used to switch to different user)

rmdir: to delete empty directory / folder (can be used to remove empty directory)

rm: to delete files and directories / folders can be used to remove files and directories (emptry or non empty)

password: to change the user password (can be used to change user password)

unzip: to unzip the zip file (to unzip or uncompress zip file)

shutdown: to shutdown the system (to shutdown machine)

Bc Command

The bc command is used to get the facility of calculator on the terminal. For this, type .bc command at the prompt and press enter key. This will activate the calculator facility. Now we can do any calculation, close it and press Ctrl + D to go back to the prompt.

$ bc
22 + 33
55

Cat command

This command is used to prompt and create a new file. This command is similar to the copycon command of DOS.

Command structure: –

$ Cat>
…… ………….
…… ………….
˄D

It is clear from the above structure that using the ‘>’ sign with the cat command, a new file will be created with the name given. When typing a mater in the file, every line will end when it is pressed and the file will be closed. Use Ctrl + D.

Cp command

This command is used to copy files.

Command structure: –

$ Cp><source filename><target filename>

Cd command

The word cd means “change directory” meaning that we use that command to go to a directory and its subdirectory. This is similar to the cd command of DOS where the directory given when citing a directory with cd is activated. She goes

Command structure: –

Cd><Diroctoryname>


Chgrp command

This command is used to change group ownership.

Command structure: –

$ Chrgp [Option] …… ..<groupname><filename>

chmod command

chmod command

This command is used to change the access permission of the file. If we look at the detailed list of files by the Is-1 Command or by giving the name of a file with Is-1, a detailed description of that file appears as follows.
Ex: – $ 1s-1 Maruti
Rwx rwx rwx 1 root root 35 June 15 18:52 Maruti

Following is the description of the above output file

The name of the access owner (Owner), the size of the file, the date and time, and the name of the file is as clear that the first information in the above description is showing the access rights. | In the example taken here, we see the rwx rwx rwx written with the access rights section of the description where the above r, w, and x means

r – read
w – write
x – execute

Command structure: –

Chown [:> groupname]> filename>
Here the name of the group is optional when both the owner and the group of the file have to change.
Ex. $ 1s – Maruti

Who

Using this command, the list of the currently logged in user is displayed on the system, through this command various information regarding all the users like name, terminal number, time of login, and date are displayed.
$ who {enter}
User names Terminal no. Login date Login Time
Ravi tty10 Jan 14 12:30
Rahul tty10 Jan 14 13:00

Command structure: –

$ who<username> {enter}
Ex. : – $ who gour {enter}

If the gour user is not present when the above command is executed, the following information is displayed
gour does not exit
If this user is present then only information related to the username is displayed.
If the user wants to know which login he is currently working on, the following command is used for him
who I am {enter}
With this, information related to the user who is logged on is displayed.

With this command, you can check current time and date.

The mv command is also used to move a file or dir from one place to another.

syntax: – mv [option] source target

Touch Linux Command

Use of touch command goes to create Empty file

Syntax- $ touch<filename>

Ex. Touch file1 then enter press button

If you want to create multiple file simultaneously, you can do this –

More Linux Command

With the help of more command, the content of the file is shown in 1 page, that is, whatever the content of the file is, it will be shown only in one page and the rest will tell by doing more (more 41%).

The space button is used to show the rest and all the content, it is called Internal Command.

Some of the more commands are internal commands like: –

-f = This will slap the remaining content

enter = one – advances a line

5s = 5 line forward

5f = 5 page forward

f = Next page forward

Less Linux Command

The content of the file is shown in 1 page with the help of more command.

one line forward – Enter and I

one page Forward – Space Button and f

10 line forward – 10j

Some more options of Less Comand are –

-P = file can go into begging

-G = can go to the end of the file

-b = one page backward

Can not do 10/15 page forward / backward with less command while more is in command it only has 1 page forward / backward

Sort Linux Command

With this command, the files are sorted and the contents of the file become automatic sort.

This is used to sort files

sort command does not change in the original file, only by copying the content of that file and show it by sorting.

Syntax: – sort<filename>

sort -r file2 ↵

Unique Linux Command

With this command, print / show common name or same name once.

These commands work in only one file, ie there should be a file, same name means remove duplicate.

Does not change the original file

If you want to save this output, you can use Redirection (>).

Tr Linux command

translating character

tr command manipulates individual characters in a character string

Syntax: – tr option exp1 exp2<standard file>

This command replaces the missing word in the content.

does not make changes to the original content

By taking input from a file and processing it, it shows and does not change the original content or file, such a command is called Filter Command.

Some options of tr command are: –

-d = to delete a character
tr -d ‘y’ <filename>

grep linux Command

Full name of GREP – Globally Search a Regular Expression And Print

The grep command is used to search / find a word or a file or content.
syntax: – grep option pattern filename

Post a Comment

0 Comments