SlideShare une entreprise Scribd logo
1  sur  6
Unix Command
What is UNIX?
 UNIX is an operating system which was first developed in the 1960s.
 It is a stable, multi-user, multi-tasking system for servers, desktops and laptops.

Types of UNIX
There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun
Solaris, GNU/Linux, and MacOS X.
The UNIX operating system
The UNIX operating system is made up of three parts; the kernel, the shell and the programs.
Kernel: The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the file store
and communications in response to system calls.
Shell: The shell acts as an interface between the user and the kernel.

Command
ls

Syntax

Descriptions
Lists files in current directory.
Gives a "long listing" of the files in current directory.
List all files including hidden files.
Recursively list contents of sub-folders.

ls -m
ls -lt
ls -ltr
ls –lS
ls –lSr

Atul Pant

ls
ls -l
ls -a
ls -lR

List one file or folder per line and separate content by commas.
list the contents with modification time descending order
List the contents in reverse order based on time.
List the contents ordered by size ascending.
List the contents in reverse order by size.

Page 1
Unix Command
cat

cat filename [-n] [-b] [-u] [-s] [-v]
cat [file.txt] [file2.txt] > [file3.txt]

Allows look, modifying or combining a file.
Reads file1.txt and file2.txt and combines those files to make file3.txt.

cut

cut [-b] [-c] [-f] list [-n] [-d delim]
[-s] [file]
cut –b [file.txt]

To extract parts of each line of a file.

cut –c [file.txt]

The list following -b specifies byte positions (for instance, -b1-72 would pass the
first 72 bytes of each line).
The list following -c specifies character positions (for instance, -c1-72 would pass
the first 72 characters of each line).

sort

sort [options] [file]
sort –r [file.txt]
sort –n [file.txt]
sort –u [file.txt]

Sorts the lines in a text file.
Sort the file, file.txt in reverse order.
Sort numerically
Pick unique lines in a file and then sort them.

uniq

uniq [-c | -d | -u ] [ -f fields ] [ -s
char ] [-n] [+m] [input_file] [
output_file]
uniq –i [file.txt]
uniq –c [file.txt]
uniq –u [file.txt]
uniq –d [file.txt]

Report or filter out repeated lines in a file.

grep [options] PATTERN [file]
grep "one" file.txt
grep -i "one" file.txt
grep "one * two" file.txt

Finds text within a file.
Search file.txt in the current directory for any reference of one.
grep case-insensitively.
use wildcard * (asterisk).

grep

Atul Pant

Identify case-insensitive unique lines.
Get count of unique lines.
Get only unique lines from a file.
Get all duplicate lines from a file.

Page 2
Unix Command
df

df [OPTION] [FILE]
df -h
df -hT
df -BG

du

List all the file systems on the system, their mount points and their total size, free
size and used size.
Displays the sizes in an easy to read format.
Display type of file-system
Display size of file systems in specified units

du [-a] [-k] [-s] [-d] [-L] [-o] [-r] [x] directories
du –h test

Tells you how much space a file occupies.

ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [l] [-L] [-P] [-y] [ -g grplist ] [ -n
namelist ] [-o format ] [ -p
proclist ] [ -s sidlist ] [ -t term] [ u uidlist ] [ -U uidlist ] [ -G
gidlist ]
ps –e | head –n3
ps –p1
ps –p1,2

Displays the list of all processes that the system's processor is currently handling.

kill

kill [-s] [-l] [pid]
kill -9 [pid]
killall java

It will kill or stop running processes.
To forcefully kill a process.
To kill processes by name

split

split [-linecount | -l linecount ] [
-a suffixlength ] [filename]
split –l1000 file.txt
split –b5m file.txt

Split a file into pieces.

ps

Atul Pant

Display human-readable size for files/folders listed by 'du'

Display all running processes
Display processes based on process id
Display multiple processes by process ids

To split a file based on number of lines.
to split a file based on size of data

Page 3
Unix Command
chmod

chmod 111 a.txt
chmod 222 a.txt

Changes the permission of a file. There are 3 types of permissions for a file i.e. read,
write and execute abbreviated as r, w and x respectively. This command also
assigns numbers 4, 2 and 1 to read, write and execute permissions respectively.
These 3 permissions can be separately set for three types owner, group, everyone
else.
---x--x—x
--w--w--w-

crontab

crontab [-u user] file
crontab -l
crontab -e
crontab -r

It’s used to schedule scripts to run periodically at configured times.
To display jobs scheduled in crontab.
To add, update or delete jobs from crontab.
To delete all scheduled jobs from crontab.

find

find
find .

Finds one or more files assuming that you know their approximate filenames.
List contents of current folder using 'find' comamnd

cp

cp
cp a.txt b.txt
cp a.txt newdir(/home/)

It’s used to create copies of files and folders.
To copy a file in same directory.
To copy a file in different directory.

mv

mv [-f] [-i] oldname newname
mv a.txt b.txt
mv a.txt subdir (/home/)
mv subdir copydir

It’s used to move files/folders from one folder to another.
To move a file to another file.
To move a file to another folder.
to move a folder.

Atul Pant

chmod [OPTION] [MODE]
[filename]

Page 4
Unix Command
rm

rm [-f] [-i] [-R] [-r] [filenames |
directory]
rm file.txt
rm –f file.txt
rm –rf subdir

It’s used to delete files and folders.

mkdir

mkdir [option] directory
mkdir subdir
mkdir –p subdirA/sundirB

To create a new directory.
To make a folder.
To make a folder and sub-folders hierarchy.

zip

zip first.zip
unzip –l first.zip

To compress files/folders to a smaller size. Zipping a file helps save disk space
while storing or helps conserve network bandwidth while transporting the file.
It’s used to extract the files/folders from a zipped file.

tar

tar
tar -cvwf file.tar myfile.txt
tar -xvwf myfile.tar

Create Tape ARchives (TAR) and add or extract files.
Creating a tar file.
Extracting the files from a tar file.

tail

tail
tail -n2 basic.txt
tail -f error.log

It will display the last n lines or last n bytes from a byte. It can also monitor a file.
To display last n lines of a file.
To use option -f to track changes to a file.

paste

paste [-s] [-d list] file

It’s used to merge multiple files together.

Atul Pant

To delete a file.
To delete a file without prompting.
To delete a folder.

Page 5
Unix Command
References:
http://www.computerhope.com/unix.htm
http://2min2code.com/categories/unix_commands
http://www.masswerk.at/jsuix/

Atul Pant

Page 6

Contenu connexe

Tendances

An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to LinuxDimas Prasetyo
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guidewensheng wei
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheetWe Ihaveapc
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command ReferenceSumankumar Panchal
 
Introduction to LINUX
Introduction to LINUXIntroduction to LINUX
Introduction to LINUXAVI DHALL
 
Introduction to linux day-3
Introduction to linux day-3Introduction to linux day-3
Introduction to linux day-3Gourav Varma
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editorshanmuga rajan
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in LinuxPegah Taheri
 

Tendances (17)

An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheet
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Unix cmd
Unix cmdUnix cmd
Unix cmd
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
 
Introduction to LINUX
Introduction to LINUXIntroduction to LINUX
Introduction to LINUX
 
Directories description
Directories descriptionDirectories description
Directories description
 
Introduction to linux day-3
Introduction to linux day-3Introduction to linux day-3
Introduction to linux day-3
 
Group13
Group13Group13
Group13
 
Linux commd
Linux commdLinux commd
Linux commd
 
Linux commd
Linux commdLinux commd
Linux commd
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
 
Linux
LinuxLinux
Linux
 
Prabu linux
Prabu linuxPrabu linux
Prabu linux
 

En vedette

Rest Api Performance Testing with JMeter and EC2
Rest Api Performance Testing with JMeter and EC2Rest Api Performance Testing with JMeter and EC2
Rest Api Performance Testing with JMeter and EC2Maneesh Srivastava
 
XPath XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...
XPath  XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...XPath  XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...
XPath XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...Wishtree Technologies
 
Computaris Top Testing Suite (Full Demonstration)
Computaris Top Testing Suite (Full Demonstration)Computaris Top Testing Suite (Full Demonstration)
Computaris Top Testing Suite (Full Demonstration)Computaris
 
Performance Requirement Gathering
Performance Requirement GatheringPerformance Requirement Gathering
Performance Requirement GatheringAtul Pant
 
Performance Testing in a Mobile World
Performance Testing in a Mobile WorldPerformance Testing in a Mobile World
Performance Testing in a Mobile Worldstuartmoncrieff
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With JmeterAdam Goucher
 
LoadRunner Performance Testing
LoadRunner Performance TestingLoadRunner Performance Testing
LoadRunner Performance TestingAtul Pant
 
Automation - Apache JMeter
Automation - Apache JMeterAutomation - Apache JMeter
Automation - Apache JMeterWira Santos
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in JmeterViviana Lesmes
 
Performance Testing for Mobile Apps & Sites using Apache JMeter
Performance Testing for Mobile Apps & Sites using Apache JMeterPerformance Testing for Mobile Apps & Sites using Apache JMeter
Performance Testing for Mobile Apps & Sites using Apache JMeterAlon Girmonsky
 
Performance Test Plan - Sample 1
Performance Test Plan - Sample 1Performance Test Plan - Sample 1
Performance Test Plan - Sample 1Atul Pant
 
Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeterjvSlideshare
 
Interpreting Performance Test Results
Interpreting Performance Test ResultsInterpreting Performance Test Results
Interpreting Performance Test ResultsEric Proegler
 
Performance Testing
Performance TestingPerformance Testing
Performance Testingsharmaparish
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance TestingAtul Pant
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeterBhojan Rajan
 
Performance testing of mobile apps
Performance testing of mobile appsPerformance testing of mobile apps
Performance testing of mobile appsvodQA
 

En vedette (18)

JMeter
JMeterJMeter
JMeter
 
Rest Api Performance Testing with JMeter and EC2
Rest Api Performance Testing with JMeter and EC2Rest Api Performance Testing with JMeter and EC2
Rest Api Performance Testing with JMeter and EC2
 
XPath XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...
XPath  XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...XPath  XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...
XPath XQuery Training by Wishtree in India Pune Bangalore Bengaluru Gurgaon ...
 
Computaris Top Testing Suite (Full Demonstration)
Computaris Top Testing Suite (Full Demonstration)Computaris Top Testing Suite (Full Demonstration)
Computaris Top Testing Suite (Full Demonstration)
 
Performance Requirement Gathering
Performance Requirement GatheringPerformance Requirement Gathering
Performance Requirement Gathering
 
Performance Testing in a Mobile World
Performance Testing in a Mobile WorldPerformance Testing in a Mobile World
Performance Testing in a Mobile World
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With Jmeter
 
LoadRunner Performance Testing
LoadRunner Performance TestingLoadRunner Performance Testing
LoadRunner Performance Testing
 
Automation - Apache JMeter
Automation - Apache JMeterAutomation - Apache JMeter
Automation - Apache JMeter
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in Jmeter
 
Performance Testing for Mobile Apps & Sites using Apache JMeter
Performance Testing for Mobile Apps & Sites using Apache JMeterPerformance Testing for Mobile Apps & Sites using Apache JMeter
Performance Testing for Mobile Apps & Sites using Apache JMeter
 
Performance Test Plan - Sample 1
Performance Test Plan - Sample 1Performance Test Plan - Sample 1
Performance Test Plan - Sample 1
 
Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeter
 
Interpreting Performance Test Results
Interpreting Performance Test ResultsInterpreting Performance Test Results
Interpreting Performance Test Results
 
Performance Testing
Performance TestingPerformance Testing
Performance Testing
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
 
Performance testing of mobile apps
Performance testing of mobile appsPerformance testing of mobile apps
Performance testing of mobile apps
 

Similaire à Unix command

Similaire à Unix command (20)

Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scripts
 
Unix short
Unix shortUnix short
Unix short
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Prabu linux
Prabu linuxPrabu linux
Prabu linux
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in Linux
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
basic-unix.pdf
basic-unix.pdfbasic-unix.pdf
basic-unix.pdf
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 

Plus de Atul Pant

Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs JmeterAtul Pant
 
Performance Test Plan - Sample 2
Performance Test Plan - Sample 2Performance Test Plan - Sample 2
Performance Test Plan - Sample 2Atul Pant
 
Testing check list
Testing check listTesting check list
Testing check listAtul Pant
 
Payment gateway testing
Payment gateway testingPayment gateway testing
Payment gateway testingAtul Pant
 
Cloud computing
Cloud computingCloud computing
Cloud computingAtul Pant
 
E commerce Testing
E commerce TestingE commerce Testing
E commerce TestingAtul Pant
 

Plus de Atul Pant (7)

Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs Jmeter
 
Sql
SqlSql
Sql
 
Performance Test Plan - Sample 2
Performance Test Plan - Sample 2Performance Test Plan - Sample 2
Performance Test Plan - Sample 2
 
Testing check list
Testing check listTesting check list
Testing check list
 
Payment gateway testing
Payment gateway testingPayment gateway testing
Payment gateway testing
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
E commerce Testing
E commerce TestingE commerce Testing
E commerce Testing
 

Dernier

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Unix command

  • 1. Unix Command What is UNIX?  UNIX is an operating system which was first developed in the 1960s.  It is a stable, multi-user, multi-tasking system for servers, desktops and laptops. Types of UNIX There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X. The UNIX operating system The UNIX operating system is made up of three parts; the kernel, the shell and the programs. Kernel: The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the file store and communications in response to system calls. Shell: The shell acts as an interface between the user and the kernel. Command ls Syntax Descriptions Lists files in current directory. Gives a "long listing" of the files in current directory. List all files including hidden files. Recursively list contents of sub-folders. ls -m ls -lt ls -ltr ls –lS ls –lSr Atul Pant ls ls -l ls -a ls -lR List one file or folder per line and separate content by commas. list the contents with modification time descending order List the contents in reverse order based on time. List the contents ordered by size ascending. List the contents in reverse order by size. Page 1
  • 2. Unix Command cat cat filename [-n] [-b] [-u] [-s] [-v] cat [file.txt] [file2.txt] > [file3.txt] Allows look, modifying or combining a file. Reads file1.txt and file2.txt and combines those files to make file3.txt. cut cut [-b] [-c] [-f] list [-n] [-d delim] [-s] [file] cut –b [file.txt] To extract parts of each line of a file. cut –c [file.txt] The list following -b specifies byte positions (for instance, -b1-72 would pass the first 72 bytes of each line). The list following -c specifies character positions (for instance, -c1-72 would pass the first 72 characters of each line). sort sort [options] [file] sort –r [file.txt] sort –n [file.txt] sort –u [file.txt] Sorts the lines in a text file. Sort the file, file.txt in reverse order. Sort numerically Pick unique lines in a file and then sort them. uniq uniq [-c | -d | -u ] [ -f fields ] [ -s char ] [-n] [+m] [input_file] [ output_file] uniq –i [file.txt] uniq –c [file.txt] uniq –u [file.txt] uniq –d [file.txt] Report or filter out repeated lines in a file. grep [options] PATTERN [file] grep "one" file.txt grep -i "one" file.txt grep "one * two" file.txt Finds text within a file. Search file.txt in the current directory for any reference of one. grep case-insensitively. use wildcard * (asterisk). grep Atul Pant Identify case-insensitive unique lines. Get count of unique lines. Get only unique lines from a file. Get all duplicate lines from a file. Page 2
  • 3. Unix Command df df [OPTION] [FILE] df -h df -hT df -BG du List all the file systems on the system, their mount points and their total size, free size and used size. Displays the sizes in an easy to read format. Display type of file-system Display size of file systems in specified units du [-a] [-k] [-s] [-d] [-L] [-o] [-r] [x] directories du –h test Tells you how much space a file occupies. ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [l] [-L] [-P] [-y] [ -g grplist ] [ -n namelist ] [-o format ] [ -p proclist ] [ -s sidlist ] [ -t term] [ u uidlist ] [ -U uidlist ] [ -G gidlist ] ps –e | head –n3 ps –p1 ps –p1,2 Displays the list of all processes that the system's processor is currently handling. kill kill [-s] [-l] [pid] kill -9 [pid] killall java It will kill or stop running processes. To forcefully kill a process. To kill processes by name split split [-linecount | -l linecount ] [ -a suffixlength ] [filename] split –l1000 file.txt split –b5m file.txt Split a file into pieces. ps Atul Pant Display human-readable size for files/folders listed by 'du' Display all running processes Display processes based on process id Display multiple processes by process ids To split a file based on number of lines. to split a file based on size of data Page 3
  • 4. Unix Command chmod chmod 111 a.txt chmod 222 a.txt Changes the permission of a file. There are 3 types of permissions for a file i.e. read, write and execute abbreviated as r, w and x respectively. This command also assigns numbers 4, 2 and 1 to read, write and execute permissions respectively. These 3 permissions can be separately set for three types owner, group, everyone else. ---x--x—x --w--w--w- crontab crontab [-u user] file crontab -l crontab -e crontab -r It’s used to schedule scripts to run periodically at configured times. To display jobs scheduled in crontab. To add, update or delete jobs from crontab. To delete all scheduled jobs from crontab. find find find . Finds one or more files assuming that you know their approximate filenames. List contents of current folder using 'find' comamnd cp cp cp a.txt b.txt cp a.txt newdir(/home/) It’s used to create copies of files and folders. To copy a file in same directory. To copy a file in different directory. mv mv [-f] [-i] oldname newname mv a.txt b.txt mv a.txt subdir (/home/) mv subdir copydir It’s used to move files/folders from one folder to another. To move a file to another file. To move a file to another folder. to move a folder. Atul Pant chmod [OPTION] [MODE] [filename] Page 4
  • 5. Unix Command rm rm [-f] [-i] [-R] [-r] [filenames | directory] rm file.txt rm –f file.txt rm –rf subdir It’s used to delete files and folders. mkdir mkdir [option] directory mkdir subdir mkdir –p subdirA/sundirB To create a new directory. To make a folder. To make a folder and sub-folders hierarchy. zip zip first.zip unzip –l first.zip To compress files/folders to a smaller size. Zipping a file helps save disk space while storing or helps conserve network bandwidth while transporting the file. It’s used to extract the files/folders from a zipped file. tar tar tar -cvwf file.tar myfile.txt tar -xvwf myfile.tar Create Tape ARchives (TAR) and add or extract files. Creating a tar file. Extracting the files from a tar file. tail tail tail -n2 basic.txt tail -f error.log It will display the last n lines or last n bytes from a byte. It can also monitor a file. To display last n lines of a file. To use option -f to track changes to a file. paste paste [-s] [-d list] file It’s used to merge multiple files together. Atul Pant To delete a file. To delete a file without prompting. To delete a folder. Page 5