What is Unix?

(Dennis, Ken)


What is GNU?


What is Linux (or GNU/Linux) ?


How is Unix different from Linux?


GNU/Linux Distributions

Linux_Distribution_Timeline


Terminal

A computer terminal is a hardware device that is used for entering data into, and displaying or printing data from a computer or a computing system.


Basic GNU/Linux Commands


Frequently Used Terms

  • File and Folder
  • Directory
    • Parent Directory
    • Working Directory
  • User
  • Root or Root Directory
  • Environments
  • Backup
  • Command, Command Line, Console
  • Warning, Error, Permission Denied
  • Segmentation Fault

Frequently Used Terms

  • File and Folder
  • Directory Path, Parent and Working Directory


Frequently Used Terms

User, Root and Home Directory

whoami
## emirtoker

Root directory symbol; “/”. Home directory symbol; “~”.


Frequently Used Terms

Environments and Backup

printenv  


Frequently Used Terms

Command Line, Command


Frequently Used Terms

Warning, Error, Permission Denied, Segmentation Fault


Directory Commands

  • pwd (Print Working Directory)

  • ls (List Directories)

  • cd (Change Directory)

  • mkdir (Make Directory)


Directory Commands - pwd

(Print Working Directory)

pwd
## /Users/emirtoker/Desktop/Memurluk/Software_Tools_for_Earth_&_Environmental_Science/Software_Tools_R_Github


Directory Commands - ls

(List Directories)

ls
## LICENSE
## Presentation
## README.html
## README.md
## R_Home_Website
## R_Interactive_Samples_with_Shiny.Rmd
## R_Interactive_Samples_with_Shiny.html
## R_Interactive_Samples_with_Shiny_files
## R_Interactive_Training
## Software_Tools_R_Github.Rproj
## Software_Tools_for_Earth_and_Environmental_Science_Syllabus.png
## Software_Tools_for_Earth_and_Environmental_Science_Syllabus_2020_21_Fall.png
## _site.yml
## about.Rmd
## additional_course.Rmd
## book.Rmd
## code.Rmd
## data.Rmd
## data_sources.Rmd
## data_structure.Rmd
## datacamp.Rmd
## dc_logo1.png
## dc_logo2.png
## dc_logo3.png
## dc_logo4.png
## dc_logo5.png
## docs
## index.Rmd
## my_r_notebook.Rmd
## ncl.Rmd
## netcdf.Rmd
## new_accounts.Rmd
## new_data.csv
## python.Rmd
## r_and_rstudio.Rmd
## r_language.Rmd
## r_probability.Rmd
## r_programming.Rmd
## r_statistics.Rmd
## rsconnect
## syllabus.Rmd
## unix_linux.Rmd

Directory Commands - pwd and ls


Directory Commands - cd

(Change Directory)

cd Presentation/


Directory Commands - mkdir

(Make Directory)

mkdir <new_folder_name>


File Commands

  • touch

  • cat (Concatenate)

  • rm (Remove)

  • cp (Copy)

  • mv (Move)


File Commands - touch

touch <my_new_file>


File Commands - cat

(Concatenate)

cat my_new_file
This is my new file. Hi!


File Commands - cp

(Copy)

cp my_new_file my_new_file2


File Commands - mv

(Move)

mv my_new_file2 my_new_file3


File Commands - rm

(Remove)

rm my_new_file my_new_file3


Special Commands

  • find

  • help

  • history

  • clear

  • date and cal

  • exit


Special Commands - find

find -name <name_of_file>


Special Commands - help

find --help


Special Commands - history

history


Special Commands - clear

clear


Special Commands - date and cal

date
## Thu Oct 22 01:30:50 +03 2020
cal
##     October 2020      
## Su Mo Tu We Th Fr Sa  
##              1  2  3  
##  4  5  6  7  8  9 10  
## 11 12 13 14 15 16 17  
## 18 19 20 21 _2_2 23 24  
## 25 26 27 28 29 30 31  
## 

Special Commands - exit

exit


Symbols

  • | (and)
  • > (assing)
  • $ (special variable)
  • ? (an unknown character)
  • * (an unknown sroup of characters)
cat my_profile | sort
ls > my_list
x=3
echo $x
ls my*
ls ?y_list* 

vi Editor and Print Commands

  • vi

  • esc (default mode)

  • i (insert mode)

  • :q (just quit)

  • :q! (don’t save and quit)

  • :qw (write/save and quit)

  • grep and echo

  • head and tail

  • sed (stream editor)


vi Editor and Print Commands - vi


vi Editor and Print Commands - esc

(Default Mode)


vi Editor and Print Commands - i

(Insert Mode)


vi Editor and Print Commands - :wq

(Write/Save and Quit)


vi Editor and Print Commands - grep and echo

grep my_profile
grep ITU my_profile
echo my_profile
name=Emir
echo $name

vi Editor and Print Commands - head and tail

head my_profile
tail my_profile

vi Editor and Print Commands - sed

(Stream Editor)

Replacing or substituting string;

sed 's/ITU/ODTU/' my_profile
sed '5d' my_profile 

Bash Script

touch my_bash_script.sh
vi my_bash_script.sh
x=5
y=3
echo $((x+y))
bash my_bash_script.sh
8

Practice and Quiz


Practice

  1. Learn where you are (Print your working directory)
  2. Look at inside (list all documents and directories)
  3. Create a new folder (make a directory,<my_new_dir>)
  4. Go to the <my_new_dir> (change your directory)
  5. Create a new file (touch it, file name : <my_new_file>)
  6. Open this new file and write your name (vi-insert mode)
  7. Save your work and close the file (write + quit)
  8. Print your name on the screen (grep, tail, head, cat)
  9. Put <my_new_file> at the parent directory (move it)
  10. Go to parent directory (change directory with two dots)
  11. Create a copy, name; <my_new_file_2>
  12. Remove your first folder <my_new_dir>
  13. List all documents and directories

Quiz

Introduction to Gnu/Linux

LINK