0% found this document useful (0 votes)
11 views5 pages

Command Line Basics and Usage Guide

The document provides instructions for several common Linux commands. It covers commands for viewing system information, manipulating files and directories, permissions, text editing and filtering. Some key commands described are date, cal, whoami, hostname, ls, cat, cp, mv, rm, grep, sort, chmod, vi and sed. Ranges, options, symbolic and numeric permissions are also explained.

Uploaded by

Tushar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Command Line Basics and Usage Guide

The document provides instructions for several common Linux commands. It covers commands for viewing system information, manipulating files and directories, permissions, text editing and filtering. Some key commands described are date, cal, whoami, hostname, ls, cat, cp, mv, rm, grep, sort, chmod, vi and sed. Ranges, options, symbolic and numeric permissions are also explained.

Uploaded by

Tushar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

command should be small letter ---sdet

case sensitive
linx----freely available
unix----paid version
[Link] - --show the current date
[Link]---calender
[Link] 1994 ---show this year claneder
[Link] 3 1994----showing particular
[Link] march 1990 ---showing particular month of year
[Link] ----check the own user id
[Link] -all ---login plus logout user id list ( who space hypen all)
[Link] --only login person userid
[Link]---devicename
[Link] -i ----network ip address
[Link] ----decrption of that particular command
[Link] cal -----man command provide total discription
[Link] ------show the list of the file
[Link]-----ctrl plus D----lines-words--bytes--

class--02

[Link] > T_42 - for creating file


[Link] T_42 ---opening the file
[Link] >> T_42 ---update the data in the file
[Link] Q42 ----Create the empty file
[Link] -l ---check the size of file
[Link] file_name ---show the only 30 percent data---press spacebar--
21.q ---exist from file
[Link] file1 file2 ----2nd file data first ereae first then copy it in 2n file---
file1 data copy to file2 data.--copy-paste date
[Link] q1 q2----first file data earse/cut the data then paste the data in the
secound file----cut paste command
-- first file data overwrite on 2nd file data.
[Link] q1 >> q2 --first file data without overwrite on 2nd file data it will be
copy to 2nd file [Link] also called concat operation.
[Link] q1 ----remove/delete/drop the file from the system with help of rm command
from list
[Link] -l filename ---show the lines of file
[Link] -w filename ----show the words count
[Link] -c filename ---show the byte count

classNo 3

[Link] to display particular middle row


(upper limit-lower limit)+1=tail
head -8
tail -6
---------
head -8 t_42 | tail -6
head -upper limit(int) file_name | tail int
---
[Link] to display particular lines--head -8 t_42 | tail -1
[Link] 10 lines display
head -8 file_name

[Link] 10 lines display


tail -10 file_name
[Link]
grep 'Pune' file_name --findout the particular keyword in the file

[Link] -i 'pune' file_name ---cancel out sase sensitive format

35. grep -i -n 'pune' q21 ---show the particular lines no where this keyword has
present.

[Link] -i -c 'pune' q21 ---showing the count of the particualr keyword(not


consisder as case sensitive)

[Link] -c 'pune' q21 --showing only particular fromat keyword count--it has to be
case sensitive

[Link] -i 'pune' q21 && grep 'is' q21 ---filter out multiple keyword

grep -i 'pune' q21 && grep 'is' q21 && grep 'good' q21---3 word seraching

[Link] -i -v 'pune' q21 ---showing the data excludeing that particular keyword
sentence.

-n---lines no
-c -- count
-i---case sensitive remove
-v ==not equal to
-r ==history

[Link] -i -r 'pune'---you can get complete history of particualr keyword

grep -r 'pune'

class No 4

[Link] -n file_name ----sorting the data of the file in ascending order.


[Link] -n -r file_name --sorting the data of the file in the descenting order.
[Link] filename---compressing the file in the zip
[Link] file_name ---unzipping the file

white --file
blue ---folder
red--zip file
[Link] file zip:- gzip q22 q21

[Link] file unzip :- gunzip q22 q21

[Link] directory :- mkdir Filename

[Link] multiple directory at once :- mkdir file1 file2

[Link] multiple sub directory :- mkdir -p T1/T1/T3/T4


-P stands for path

[Link] directory---cd directory_name


cd stands for change directory

[Link] back to previous directory --- cd ..

[Link] ..
[Link] ../../../

[Link] onece we need to go in required directory ---cd T1/T2/T3/T4

[Link] onece we need to go to Home directory -- cd ~


~ stand for tills

[Link] only empty directory---rmdir fileName

[Link]/delete /drop the file or directory --rm -r file_name

[Link] --present working directory

Read ---open permission


write ---edit/append permission
excute --excute permission

owner/user Group others

3 3 3

Total 10 char---1 char hypen means file


1 char d meand directrory

class No 5

symbolic method

r--read

w--write

x---excute

u---user
g --group
o---others

[Link] u+x,g+w,o+wx file_name ----give the permission to acess the particular


file

[Link] u-w,g+x file_name ---remove the permission of particular file.

[Link] ugo-rwx---all permission remove

59. chmod ugo+rwx ---all permission has given.

[Link] the pernission - ls -l file_name

Numeric Method
Num

r--read 4

w--write 2

x---excute 1
[Link] 635 file_name ---give the permission

[Link] 777 filename ---all permission given

[Link] 77 file ---means chmod 077 file---permission given to all except user

[Link] 7 file----means chmod 007 file

[Link] 000 file ----remove the permission

[Link] to change ownership of the file

chown 'amit' file_name]

67. how to change group ownership of the file

chgrp 'project' file_name

[Link]----how many process run at a time

[Link] -process_id ---terminate the particular process--i dnot have acess of this
command--develpoer has access of this.

[Link] ---disk usage

[Link] -a ---all file data

[Link] -ah --all data display with extension

[Link]-disk free

[Link] -h --disk free with extension

class No 6

[Link] -n '2p'file_name ----display the position of 2nd line --p stand for position

76. sed -n '2p;4p;10p' file_name ---diaplay the particular line

77. sed -n '3,8p' file_name ---display the particualr range of line

[Link] -i '2d'file_name ===delete the particular line== d stanads for delete.

[Link] -i '2d;4d;10d' file_name ===delete the particular line permantely.

80..sed -i '3,7d' file_name =delete the range of line permantely.

REPLACE:-

[Link] -i 's/pune/mumbai/g' file_name ---repalce the mention word in list with all
prsent word.

Display the column:-

[Link] '{print $2}' file_name ---display the column of the text in the file.
82 awk '{print $2 $4}' file_name ---display the multiple column in the file

[Link] 'NR>1 && NR<3' file_name---display the row of the file

vi--

1..vi fil_name --open the file

[Link] i ---insert mode ON

[Link] ---exist from insert

[Link] x -- for delete the single word

[Link] dw --delete the particular word

[Link] db --delete the particular line

7.u --undo

8.k --up side


j --down
l--right
h --left

[Link] --copy

10.p --paste

[Link]--particular word copy

12 --last command excute -- press .

[Link] paste --db press v

14 press r --write chartcter

[Link] R --replace mode active

16.-- exist the window and save also :wq!


:wq! --save plus exist
:w! --save only
:q! --unsave and exist the task

Common questions

Powered by AI

'grep -i -v' is valuable for excluding specific case-insensitive patterns from search results, critical in scenarios demanding the analysis of data sets where exclusion of certain data is necessary, such as filtering out certain keywords from system logs for error isolation. This enhances search operations by providing flexibility in focusing on relevant data .

The 'awk' tool's capability to select specific columns and rows emphasizes Unix's strength in text processing and manipulation. This functionality allows users to efficiently extract and manipulate data subsets without loading entire datasets into memory, which is beneficial for performance and resource management in large scale data processing tasks .

The 'ps' command lists all running processes, providing critical insights into system activity and resource usage. For administrators, it is essential for monitoring system health, diagnosing issues, and performing maintenance by identifying and managing processes that consume excessive resources or exhibit irregular behavior .

The command 'chmod ugo-rwx' removes all permissions from a file for the owner, group, and others, effectively securing the file from any unauthorized access or modification. This command would be used when a file must be completely secured or quarantined, perhaps during a security audit or when sensitive data needs to be shielded from all users temporarily .

Using 'cat > T_42' creates a file while immediately allowing the user to input content into it, while 'touch Q42' simply creates an empty file. This choice implies that 'cat > T_42' is more suitable when immediate data entry is required following file creation, whereas 'touch Q42' might be preferred for simply setting up file placeholders for future modification .

'gzip' compresses files to reduce size, aiding in efficient storage and transfer, while 'gunzip' decompresses them for access. These tools are pivotal in system maintenance, enabling effective disk space management and faster file transfers, essential for optimizing system resources and maintaining efficient network operations .

To display the calendar for March 1990, you use the command 'cal 3 1990'. This command signifies the capacity of Unix-like systems to access and present historical calendar data for any specified month and year, highlighting the system's capability to handle a wide range of dates beyond just the current year .

The 'chmod 777 filename' command grants all permissions (read, write, execute) to all user categories (owner, group, others). This level of openness poses a security risk as it allows unrestricted access to any user on the system, potentially leading to unauthorized modifications or execution of the file's contents by malicious actors .

'sort -n' organizes data in ascending numerical order, while 'sort -n -r' does so in descending order. These commands are advantageous in organizing large datasets, allowing for easier pattern recognition and analysis. They are especially useful in financial or scientific data analysis, where order relationships are crucial .

The 'whoami' command displays the current user's ID, while 'who -all' lists both login and logout user IDs. This difference illustrates a nuanced approach to user identity management in Unix systems, where 'whoami' is focused on individual user identity querying, whereas 'who -all' provides a more comprehensive overview of user interactions with the system, capturing both past and present access .

You might also like