SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
Linux CLI

Kenneth Oraegbunam, Software Development Service




                                                   www.iita.org
Shell

• User interface to operating system
  – Text shell (cmd, sh, ash, bsh, bash, ...)
  – GUI shell (Aqua, Windows, GNOME)
• Choice of shell depends on how computer
  is used
  – Text shell for speed and experienced users
  – GUI shell for ease of use




                                                www.iita.org
Command line interface

• User input is text input
• Does not require graphics or mouse, less
  resource intensive
• Generally faster (for experienced users)
  than GUI
• Examples of CLI
  – Quake 1/2/3/4 pressing ~ key brings CLI
  – R (statistical package) is CLI
  – cmd.exe
  – Matlab
                                              www.iita.org
Command line interface

•   User input is interpreted
•   … and executed
•   Results rendered as text
•   … or as graphics

• In this session we will focus on Linux CLI
  “bash”



                                           www.iita.org
bash

• Default shell on Ubuntu
• Runs on OSX, Windows, any *NIX
• Compatible with predecessor bsh
  – Bourne shell
  – Bourne-again shell
• Command line completion (tab key)
• Wikipedia Article



                                      www.iita.org
Programs

• Programs do things
• Programs
  – Compiled programs, bash scripts, other scripts
    (#!/path/to/interpreter)
  – Executable +x flag
• PATH variable
  – Where to look for matching program
• Executing programs
  – In path: # ls
  – Not in path: # /home/user/runscript.sh
                                              www.iita.org
Program arguments and data streams

• Arguments to program
  – Anything that follows the command
• Arguments alter the way program behaves
• Any program has
  – One standard input stream STDIN
  – One standard output stream STDOUT
  – One error output stream STDERR
• System call exec, execve
  – int execve(const char *filename, char *const
    argv[], char *const envp[]);
                                               www.iita.org
Program execution

• Shell will provide
  – Running directory
  – Arguments
  – Stream redirection
     • STDIN from console
     • STDOUT to console
     • STDERR to console
• Run the command # ls -la
  – ls is the program /bin/ls
  – -la is one argument, but two flags
                                         www.iita.org
Bash built-ins

• Shell built in commands
  – cd change directory
  – pwd print current directory to STDOUT
  – echo print to STDOUT
  – exec execute command and replace current
    shell
  – exit
  – history show command line history
  – alias register alias command
  – set and unset
  – … plenty more                          www.iita.org
Other programs

• Other useful programs, not part of shell
  – ls list files in current directory
  – ps list processes
  – man display manual pages: # man ls
  – kill send signal to process
  – nano friendly text editor
  – vi, vim unfriendly text editor
  – screen text-mode window manager
  – grep filter input stream
  – cat concatenate files and print to STDOUT
  – head and tail print first/last X lines to STDOUT
                                                  www.iita.org
Hands-on Training

•   Start the terminal
•   What's the current directory?
•   Create a folder “training”
•   Navigate to folder
•   Create “README” file in “training” folder
•   Create “deleteme.txt” file
•   Remove deleteme.txt file
•   Wipe “training” folder
•   Find help for using command rmdir
                                            www.iita.org
Expansions

•   . expands to current directory
•   ~ expands to user's home directory
•   .. expands to parent directory
•   Brace expansion
    – # mkdir {old,new,current}
• Parameter expansion
    – $0, $1, $@
• Command substitution
    – # `which ls`
                                         www.iita.org
Useful commands

• Grep is used to filter lines matching a
  pattern
  – # grep PATTERN file1 file2 file3
• Cat is used to concatenate files and output
  to STDOUT
  – # cat file1 file2
• Find is used to search for matching files
  – # find /home/ubuntu (list all files there)
  – # find . (list all files from current directory)

                                                       www.iita.org
Output stream redirection

• Command # ls -1 will list files in current
  directory
• ls command writes the list of files to
  STDOUT
• Instruct bash to redirect STDOUT to a file:
  – # ls -1 > filelist.txt
• View file contents
  – # cat filelist.txt
• Filter list contents
  – # grep 'something' filelist.txt
                                          www.iita.org
Appending to file

• Instruct bash to redirect STDOUT to a file:
  – # ls -1 > filelist.txt
  – Will overwrite contents of filelist.txt
• Instruct bash to append to file
  – # ls -1 >> filelist.txt


• Redirecting both STDERR and STDOUT
  – # command &> filename
  – # command &>> filename

                                              www.iita.org
Input stream redirection

• Input stream can be replaced by file input
• grep will use STDIN if no file argument
  given
  – # grep 'test'
  – Expects input on STDIN, type something and
    press enter
• Following commands are equivalent
  – grep 'D' filename.txt
  – grep 'D' < filename.txt

                                            www.iita.org
Pipelining

• Sequence of commands where STDOUT
  (or STDERR) is attached to STDIN of
  following command
• # cat filename.txt | grep 'D'
  – cat writes filename.txt to STDOUT
  – grep will filter STDIN for lines containing D




                                                    www.iita.org

Mais conteúdo relacionado

Mais procurados

Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-serviceRohit Sansiya
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesAhmed El-Arabawy
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Ahmed El-Arabawy
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Ahmed El-Arabawy
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Ahmed El-Arabawy
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structureSreenatha Reddy K R
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linuxkishore1986
 
Linux week 2
Linux week 2Linux week 2
Linux week 2Vinoth Sn
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in LinuxPegah Taheri
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Ahmed El-Arabawy
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Ahmed El-Arabawy
 
Basic commands
Basic commandsBasic commands
Basic commandsambilivava
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Ahmed El-Arabawy
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving toolsShay Cohen
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Ahmed El-Arabawy
 

Mais procurados (20)

Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment Variables
 
UNIX Basics and Cluster Computing
UNIX Basics and Cluster ComputingUNIX Basics and Cluster Computing
UNIX Basics and Cluster Computing
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Intro to Python programming and iPython
Intro to Python programming and iPython Intro to Python programming and iPython
Intro to Python programming and iPython
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
Basic commands
Basic commandsBasic commands
Basic commands
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
Linux Fundamentals
Linux FundamentalsLinux Fundamentals
Linux Fundamentals
 
Linux Shell Basics
Linux Shell BasicsLinux Shell Basics
Linux Shell Basics
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 

Destaque

Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procKenny (netman)
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsKenny (netman)
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginnersCorrie Watt
 
Linux fundamental - Chap 01 io
Linux fundamental - Chap 01 ioLinux fundamental - Chap 01 io
Linux fundamental - Chap 01 ioKenny (netman)
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxKenny (netman)
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viKenny (netman)
 
Linux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileLinux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileKenny (netman)
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementKenny (netman)
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterKenny (netman)
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgKenny (netman)
 
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permLinux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permKenny (netman)
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingKenny (netman)
 

Destaque (14)

Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fs
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
 
Linux fundamental - Chap 01 io
Linux fundamental - Chap 01 ioLinux fundamental - Chap 01 io
Linux fundamental - Chap 01 io
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
 
Linux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileLinux fundamental - Chap 03 file
Linux fundamental - Chap 03 file
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permLinux fundamental - Chap 02 perm
Linux fundamental - Chap 02 perm
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 

Semelhante a Linux CLI Guide

Semelhante a Linux CLI Guide (20)

Linux
LinuxLinux
Linux
 
cisco
ciscocisco
cisco
 
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
 
LINUX_admin_commands.pptx
LINUX_admin_commands.pptxLINUX_admin_commands.pptx
LINUX_admin_commands.pptx
 
3. intro
3. intro3. intro
3. intro
 
LinuxCommands (1).pdf
LinuxCommands (1).pdfLinuxCommands (1).pdf
LinuxCommands (1).pdf
 
Linux
LinuxLinux
Linux
 
001 linux revision
001 linux revision001 linux revision
001 linux revision
 
proj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.pptproj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.ppt
 
redhat_by_Cbitss.ppt
redhat_by_Cbitss.pptredhat_by_Cbitss.ppt
redhat_by_Cbitss.ppt
 
Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_b
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
unit 3 ppt file represented system......
unit 3 ppt file represented system......unit 3 ppt file represented system......
unit 3 ppt file represented system......
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
Ericas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-GuideEricas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-Guide
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
linux cmds.pptx
linux cmds.pptxlinux cmds.pptx
linux cmds.pptx
 

Mais de International Institute of Tropical Agriculture

Mais de International Institute of Tropical Agriculture (20)

Make your research visible and create more impact using DataCite DOIs
Make your research visible and  create more impact using  DataCite DOIsMake your research visible and  create more impact using  DataCite DOIs
Make your research visible and create more impact using DataCite DOIs
 
Induction of early flowering in cassava through light supplementation and CM...
Induction of early flowering in cassava  through light supplementation and CM...Induction of early flowering in cassava  through light supplementation and CM...
Induction of early flowering in cassava through light supplementation and CM...
 
Producing yam mother plants to collect vines for propagation
Producing yam mother plants to collect  vines for propagationProducing yam mother plants to collect  vines for propagation
Producing yam mother plants to collect vines for propagation
 
Effects of moult and breeding on the body condition of some forest birds in s...
Effects of moult and breeding on the body condition of some forest birds in s...Effects of moult and breeding on the body condition of some forest birds in s...
Effects of moult and breeding on the body condition of some forest birds in s...
 
Conserving Nigeria’s rarest endemic bird: Ibadan Malimbe, Malimbusibadanensis
Conserving Nigeria’s rarest endemic bird: Ibadan Malimbe, MalimbusibadanensisConserving Nigeria’s rarest endemic bird: Ibadan Malimbe, Malimbusibadanensis
Conserving Nigeria’s rarest endemic bird: Ibadan Malimbe, Malimbusibadanensis
 
Cassava brown streak epidemiology in Eastern Democratic Republic of the Congo
Cassava brown streak epidemiology in Eastern Democratic  Republic of the CongoCassava brown streak epidemiology in Eastern Democratic  Republic of the Congo
Cassava brown streak epidemiology in Eastern Democratic Republic of the Congo
 
Assessment of genetic diversity among Rwandan cassava (Manihot esculenta) ger...
Assessment of genetic diversity among Rwandan cassava (Manihot esculenta) ger...Assessment of genetic diversity among Rwandan cassava (Manihot esculenta) ger...
Assessment of genetic diversity among Rwandan cassava (Manihot esculenta) ger...
 
9 osunbade identification of end users preferences of a cassava product
9 osunbade identification of end users preferences of a cassava product9 osunbade identification of end users preferences of a cassava product
9 osunbade identification of end users preferences of a cassava product
 
7 helen ufondu perception of yam landraces quality among value chain actors i...
7 helen ufondu perception of yam landraces quality among value chain actors i...7 helen ufondu perception of yam landraces quality among value chain actors i...
7 helen ufondu perception of yam landraces quality among value chain actors i...
 
8 kazeem quality attributes and consumer acceptability of cookies flavoured
8 kazeem quality attributes and consumer acceptability of cookies flavoured8 kazeem quality attributes and consumer acceptability of cookies flavoured
8 kazeem quality attributes and consumer acceptability of cookies flavoured
 
6 anajekwu ekpereka chemical, functional and pasting properties of flours pro...
6 anajekwu ekpereka chemical, functional and pasting properties of flours pro...6 anajekwu ekpereka chemical, functional and pasting properties of flours pro...
6 anajekwu ekpereka chemical, functional and pasting properties of flours pro...
 
5 seun olowote effect of drying method on caroteniod content of yellow maize
5 seun olowote effect of drying method on caroteniod content of yellow maize5 seun olowote effect of drying method on caroteniod content of yellow maize
5 seun olowote effect of drying method on caroteniod content of yellow maize
 
4 ayodele adenitan survey of dried plantain (musa paradisiaca) chips processo...
4 ayodele adenitan survey of dried plantain (musa paradisiaca) chips processo...4 ayodele adenitan survey of dried plantain (musa paradisiaca) chips processo...
4 ayodele adenitan survey of dried plantain (musa paradisiaca) chips processo...
 
2 akin olagunju does crop diversification influenc e food and nutrition secur...
2 akin olagunju does crop diversification influenc e food and nutrition secur...2 akin olagunju does crop diversification influenc e food and nutrition secur...
2 akin olagunju does crop diversification influenc e food and nutrition secur...
 
3 akinsola carotenoid apparent retention in ogi flour made from different pro...
3 akinsola carotenoid apparent retention in ogi flour made from different pro...3 akinsola carotenoid apparent retention in ogi flour made from different pro...
3 akinsola carotenoid apparent retention in ogi flour made from different pro...
 
1 pearl amadi assessing the level of consumption of pro vitamin a cassava pr...
1 pearl amadi assessing the level of consumption of pro  vitamin a cassava pr...1 pearl amadi assessing the level of consumption of pro  vitamin a cassava pr...
1 pearl amadi assessing the level of consumption of pro vitamin a cassava pr...
 
Prof janice olawoye
Prof janice olawoyeProf janice olawoye
Prof janice olawoye
 
Inqaba biotech presentation
Inqaba biotech presentationInqaba biotech presentation
Inqaba biotech presentation
 
Iarsaf symposium adaptation to climate change
Iarsaf symposium adaptation to climate changeIarsaf symposium adaptation to climate change
Iarsaf symposium adaptation to climate change
 
Bimaf iita iarsaf presentation-ibadan 21.05.19
Bimaf  iita iarsaf presentation-ibadan 21.05.19Bimaf  iita iarsaf presentation-ibadan 21.05.19
Bimaf iita iarsaf presentation-ibadan 21.05.19
 

Último

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Linux CLI Guide

  • 1. Linux CLI Kenneth Oraegbunam, Software Development Service www.iita.org
  • 2. Shell • User interface to operating system – Text shell (cmd, sh, ash, bsh, bash, ...) – GUI shell (Aqua, Windows, GNOME) • Choice of shell depends on how computer is used – Text shell for speed and experienced users – GUI shell for ease of use www.iita.org
  • 3. Command line interface • User input is text input • Does not require graphics or mouse, less resource intensive • Generally faster (for experienced users) than GUI • Examples of CLI – Quake 1/2/3/4 pressing ~ key brings CLI – R (statistical package) is CLI – cmd.exe – Matlab www.iita.org
  • 4. Command line interface • User input is interpreted • … and executed • Results rendered as text • … or as graphics • In this session we will focus on Linux CLI “bash” www.iita.org
  • 5. bash • Default shell on Ubuntu • Runs on OSX, Windows, any *NIX • Compatible with predecessor bsh – Bourne shell – Bourne-again shell • Command line completion (tab key) • Wikipedia Article www.iita.org
  • 6. Programs • Programs do things • Programs – Compiled programs, bash scripts, other scripts (#!/path/to/interpreter) – Executable +x flag • PATH variable – Where to look for matching program • Executing programs – In path: # ls – Not in path: # /home/user/runscript.sh www.iita.org
  • 7. Program arguments and data streams • Arguments to program – Anything that follows the command • Arguments alter the way program behaves • Any program has – One standard input stream STDIN – One standard output stream STDOUT – One error output stream STDERR • System call exec, execve – int execve(const char *filename, char *const argv[], char *const envp[]); www.iita.org
  • 8. Program execution • Shell will provide – Running directory – Arguments – Stream redirection • STDIN from console • STDOUT to console • STDERR to console • Run the command # ls -la – ls is the program /bin/ls – -la is one argument, but two flags www.iita.org
  • 9. Bash built-ins • Shell built in commands – cd change directory – pwd print current directory to STDOUT – echo print to STDOUT – exec execute command and replace current shell – exit – history show command line history – alias register alias command – set and unset – … plenty more www.iita.org
  • 10. Other programs • Other useful programs, not part of shell – ls list files in current directory – ps list processes – man display manual pages: # man ls – kill send signal to process – nano friendly text editor – vi, vim unfriendly text editor – screen text-mode window manager – grep filter input stream – cat concatenate files and print to STDOUT – head and tail print first/last X lines to STDOUT www.iita.org
  • 11. Hands-on Training • Start the terminal • What's the current directory? • Create a folder “training” • Navigate to folder • Create “README” file in “training” folder • Create “deleteme.txt” file • Remove deleteme.txt file • Wipe “training” folder • Find help for using command rmdir www.iita.org
  • 12. Expansions • . expands to current directory • ~ expands to user's home directory • .. expands to parent directory • Brace expansion – # mkdir {old,new,current} • Parameter expansion – $0, $1, $@ • Command substitution – # `which ls` www.iita.org
  • 13. Useful commands • Grep is used to filter lines matching a pattern – # grep PATTERN file1 file2 file3 • Cat is used to concatenate files and output to STDOUT – # cat file1 file2 • Find is used to search for matching files – # find /home/ubuntu (list all files there) – # find . (list all files from current directory) www.iita.org
  • 14. Output stream redirection • Command # ls -1 will list files in current directory • ls command writes the list of files to STDOUT • Instruct bash to redirect STDOUT to a file: – # ls -1 > filelist.txt • View file contents – # cat filelist.txt • Filter list contents – # grep 'something' filelist.txt www.iita.org
  • 15. Appending to file • Instruct bash to redirect STDOUT to a file: – # ls -1 > filelist.txt – Will overwrite contents of filelist.txt • Instruct bash to append to file – # ls -1 >> filelist.txt • Redirecting both STDERR and STDOUT – # command &> filename – # command &>> filename www.iita.org
  • 16. Input stream redirection • Input stream can be replaced by file input • grep will use STDIN if no file argument given – # grep 'test' – Expects input on STDIN, type something and press enter • Following commands are equivalent – grep 'D' filename.txt – grep 'D' < filename.txt www.iita.org
  • 17. Pipelining • Sequence of commands where STDOUT (or STDERR) is attached to STDIN of following command • # cat filename.txt | grep 'D' – cat writes filename.txt to STDOUT – grep will filter STDIN for lines containing D www.iita.org