SlideShare une entreprise Scribd logo
1  sur  130
Télécharger pour lire hors ligne
LINUX BASICS
2019/01/24
LINUX BASICS
$ whoami
▸
▸ 1072
▸ Roy
LINUX BASICS
Linux
• Unix (Unix-like)
• Linus Torvald
LINUX BASICS
Linus Torvalds
▸
▸
▸ Programmers
LINUX BASICS
Linus Torvalds
▸ Linux kernel
▸ Git
▸ Linux
LINUX BASICS
▸ Linux source code
▸ https://github.com/torvalds/linux
LINUX BASICS
Unix-like ?
▸ unix
▸ Unix
LINUX BASICS
Unix-like ?
▸ AT&T Ken Thompson Dennis Ritchie
▸ 1969
▸ 1971 C
LINUX BASICS
Unix ?
▸
▸
LINUX BASICS
Unix ?
▸
▸ AT&T
LINUX BASICS
Unix?
▸ Unix
LINUX BASICS
Linux ?
▸ Windows $$
▸
▸ Programmer CLI
LINUX BASICS
Linux ?
▸
▸ Package Manager
▸
▸ Binary, Library
LINUX BASICS
Windows QQ
▸
▸ vcpkg lib
▸ https://github.com/Microsoft/vcpkg
▸ chocolatey binary
▸ https://chocolatey.org/
LINUX BASICS
Linux
▸
▸
▸ (Kernel)
▸
LINUX BASICS
Linux
▸ Ubuntu
▸ Arch Linux
▸ distrowatch
LINUX BASICS
Linux
▸ Linux
▸
LINUX BASICS
- shell
▸
▸ Unix
▸ syscall
LINUX BASICS
syscall ?
▸ $ cat /usr/include/sys/syscall.h
LINUX BASICS
syscall ?
▸ (OS) function
▸ call
LINUX BASICS
- shell
▸ shell
▸ shell syscall
Kernel Shell User
commandsyscall
return print
other
OS Programs
LINUX BASICS
- filesystem
•
•
• windows
•
• /
•
• /dir1/dir2/…….
LINUX BASICS
- filesystem
• .
•
•
• ..
•
•
LINUX BASICS
- filesystem
•
• (/)
• /home/nisra/example.out
•
•
• ./bin/gg
• ../download/anime
LINUX BASICS
- user
•
•
• root - superuser
•
• root
LINUX BASICS
• $ who
•
•
• $ whoami
•
•
LINUX BASICS
• $ poweroff
• $ reboot
LINUX BASICS
- sudo
• sudo < >
• super user (root)
•
•
LINUX BASICS
- ls
•
• $ ls [ ...] [ ]
• -a (All)
•
• -l (List)
•
LINUX BASICS
- ls
▸
▸ $ ls -al
▸
▸ $ ls
LINUX BASICS
- pwd
• $ pwd
• print working directory
•
LINUX BASICS
- clear
▸
▸ $ clear
▸
LINUX BASICS
- clear
▸
LINUX BASICS
- mkdir
•
• $ mkdir
• $ mkdir -p 1/ 2/ 3...
LINUX BASICS
- mkdir
▸ test
▸ $ mkdir test
▸ $ ls
▸
▸ $ mkdir -p ./lev1/lev2/lev3
LINUX BASICS
- rmdir
•
• $ rmdir
• rmdir
LINUX BASICS
- rmdir
▸ test/
▸ $ rmdir test
▸ $ ls
▸
LINUX BASICS
- cd
• change directory
• $ cd
• $ cd ../
•
• ../
• cd ../../../otherdir
LINUX BASICS
- cd
▸
▸ $ mkdir test
▸ $ cd test
▸ $ pwd
▸
⽂字
- touch
• touch < >
•
• touch -t [YYYY]MMDDHHMM[.SS]
•
⽂字
- touch
▸ $ cd test
▸ $ touch newFile
▸ $ ls
⽂字
- mv
• /
• $ mv [ ] < > … < >
• -i
• -f
•
⽂字
- mv
▸ $ mkdir anotherDir
▸ $ mv newFile anotherDir/
▸ $ ls ./anotheDir/
⽂字
- cp
▸ /
▸ $ cp -rf < > ... < >
▸ -r
▸ -f
▸
▸
⽂字
- cp
• file1 file2
• $ cp file1 file2
• dir1/ dir2/
• $ cp -r dir1/ dir2/
⽂字
- rm
• remove
• $ rm [ ] …
• -f
• -i
• -r
•
⽂字
- rm
▸ helloworld
• $ rm ./hello_world
• my_private_stuff/
• $ rm -rf ./my_private_stuff/
•
⽂字
- rm
▸ $ sudo rm -rf —no-preserve-root /.
▸
▸ :think:
⽂字
GitLab
▸ (8 hr)
▸ https://www.youtube.com/watch?v=nc0hPGerSd4
⽂字
- cat
•
• $ cat < >
• $ cat -n < >
•
⽂字
- echo
• $ echo < >
•
⽂字
- less
• $ less < >
•
•
• j -
• k -
• q -
⽂字
Lab 01
•
• ~/labs/lab01/lab01.txt
•
• /
⽂字
-
• Tab
•
⽂字
-
• cd la Tab
⽂字
- man
•
• $ man < >
• manual
⽂字
man
• $ curl cht.sh/< >
• print
⽂字
apt
▸ Ubuntu Package Manager apt
▸ $ sudo apt-get install < >
⽂字
- filesystem
⽂字
- filesystem
• /home/< >
•
• ~
• /bin /sbin
•
• /usr
•
• e.g. /usr/bin
⽂字
- filesystem
• /var
• log
• /var/log
• /var/lib (package, database)
• variable
• /tmp
•
⽂字
- filesystem
• /dev
• device
•
• /etc
•
⽂字
- user
▸ (Group)
▸ uid, gid
▸
▸ /etc/passwd
⽂字
▸ $ ls -al
⽂字
▸


⽂字
⽂字
• $ chmod [ ] 1, …
• -R
•
⽂字
• $ chmod u+x file.out
⽂字
• $ chmod u+x file.out
⽂字
• $ chmod 775 myprogram
⽂字
Lab 02
• chmod
• ~/labs/lab02/
•
• ls -al
• chmod
• ./helloworld
⽂字
Lab 02
• ls -al
• $ chmod u+x ./helloworld
⽂字
- fd
▸ file descriptor
▸ 0 - stdin
▸ 1 - stdout
▸ 2 - stderr
⽂字
- (Redirect)
▸ unix-like / (Redirect)
▸
⽂字
- (Redirect)
▸ >, <
▸
▸ $ ls > list.txt # list.txt
▸ $ grep 123 < src.txt > out.txt
⽂字
- (Redirect)
▸ >>, <<
▸
▸ $ echo aa >> a.txt
▸ $ echo bb >> a.txt
▸ $ cat a.txt
⽂字
- Pipeline
▸ |
▸ stdout stdin
▸
▸ $ ls | grep aaa
⽂字
Lab 04 -
• ~/labs/lab04/
•
⽂字
- grep
▸ stdin
▸ $ grep [ ] < > < >
▸ -n
▸ -v
▸ -R
⽂字
- grep
▸ /etc/passwd nisra
▸ $ cat /etc/passwd | grep nisra
⽂字
- find
▸
▸ $ find [ ] [ ]
▸ -name < >
▸ -type
▸ f
▸ d
⽂字
- find
▸ find
▸
▸ -exec {} ;
▸ ex:
▸ find . -name *.jpg -exec rm {} ; # jpg
⽂字
Lab 03 -
▸ ~/labs/lab03/lab_03.txt
▸
⽂字
- (Process)
▸ In computing, a process is the instance of a computer
program that is being executed.
▸
⽂字
- (Process)
▸ (Process Control Block)
▸ Process
▸ PC
▸
▸
▸ I/O
▸ …
⽂字
- (Process)
▸
▸ ID(Process id)
▸ pid
▸ OS
▸ /
▸
▸ ( )
⽂字
- ps
▸ Process Status - process
▸ $ ps aux
▸ Procress
▸ $ ps auxww
▸
⽂字
- ps
▸ grep pid
▸ $ ps aux | grep sshd
⽂字
- kill
▸ Process
▸ $ kill <pid>
▸ (Signal)
⽂字
- Signals
▸ Process
▸ 9 SIGKILL
▸ 15 SIGTERM
▸ $ man signal
⽂字
- pgrep
▸ pid
▸ Process
▸ $ pgrep -i < >
⽂字
- pkill
▸ Process
▸ Process
▸ $ pkill -i < >
⽂字
- htop
▸
▸ $ htop
▸
▸ $ sudo apt-get install htop
⽂字
Lab 0? -
▸ vm
▸ process XD
▸ vm
⽂字
$ vim
•
• (text-mode)
•
⽂字
vim
•
•
•
•
⽂字
$ vim
• $ vim < >
• $ vim test.txt
⽂字
vim
• vim (mode)
•
• (Normal mode, c-mode)
• (Insert mode, i-mode)
• (command/Ed mode)
⽂字
vim
•
• j
• k
• h
• l
•
•
⽂字
vim ->
• i -
•
⽂字
• Esc Ctrl + [
⽂字
• (command mode)
• ->
• :
•
⽂字
$ vim
• :q
• :q!
• :w
• :wq = :q + :w
• :)
⽂字
vim
⽂字
vim
•
•
• /
⽂字
vim?
• $ vimtutor
•
•
⽂字
-
• 0 -
• $ -
• ^ _ -
• g_ -
•
⽂字
-
• w -
• b -
• e -
• ge -
⽂字
-
• gg -
• G -
⽂字
-
• G
•
• 150G - 150
•
• :25252 + enter
• 25252
⽂字
• :set nu
•
• : .vimrc
⽂字
• Ctrl + f - ( Page Down)
• Ctrl + b - ( Page Up)
• / 38
⽂字
• i -
• a -
• I -
• A -
• Append (v.)
⽂字
• vim
• ~/lab_vim/lab_vim.txt
⽂字
vim
• vim
⽂字
Lab webserver - web server
• apache 2
• $ sudo apt install apache2
⽂字
Lab webserver - web server
•
• index.html
• /var/www/html
⽂字
Lab webserver
• localhost
• apache http
⽂字
- wc
▸ /
▸ $ wc -l
▸ stdin (’n’)
▸ $ wc -w
▸ stdin ( )
⽂字
- cut
▸
▸ $ cut -f <N: > -d < >
▸ N
⽂字
- sort
▸
▸ $ sort
▸
▸ $ … | sort
▸
▸ $ … | sort -n
▸
⽂字
- uniq
▸
▸ sort
▸ $ … | sort | uniq
⽂字
- tr
▸
▸
▸ $ tr ab AB
▸ a -> A, b -> B
▸
▸ $ tr -d Ab
▸ A, b
⽂字
- tr
▸
▸ $ tr -s ’ ’
▸ ’ ’ 1
▸
▸ $ tr -c a @
▸ a @
⽂字
Lab 05 -
▸ ~/labs/lab05/
▸
⽂字
▸ Linux
▸
▸

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Linux basics