Linux Terminal Commands Man Pwd Ls Cd Olmo S
Total Page:16
File Type:pdf, Size:1020Kb
Python Olmo S. Zavala Romero Welcome Computers File system Super basics of Linux terminal Commands man pwd ls cd Olmo S. Zavala Romero mkdir touch Center of Atmospheric Sciences, UNAM rm mv Ex1 August 9, 2017 Regular expres- sions grep Ex2 More Python Olmo S. 1 Welcome Zavala Romero 2 Computers Welcome 3 File system Computers File system 4 Commands Commands man man pwd pwd ls ls cd mkdir cd touch mkdir rm touch mv Ex1 rm Regular mv expres- sions Ex1 grep Regular expressions Ex2 More grep Ex2 More Welcome to this course! Python Olmo S. Zavala Romero Welcome Computers File system Commands 1 Who am I? man pwd 2 Syllabus ls cd 3 Intro survey https://goo.gl/forms/SD6BM6KHKRlDOpZx1 mkdir 4 touch Homework 1 due this Sunday. rm mv Ex1 Regular expres- sions grep Ex2 More How does a computer works? Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular 1 CPU Central Processing Unit. All the computations happen there. expres- sions 2 HD Hard Drive. Stores persistent information in binary format. grep 3 RAM Random Access Memory. Faster memory, closer to the CPU, not persistent. Ex2 More 4 GPU Graphics Processing Unit. Used to process graphics. https://teentechdaily.files.wordpress.com/2015/06/computer-parts-diagram.jpg What is a file? Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Section inside the HD with 0’s and 1’s. Ex1 Regular File extension is used to identify the meaning of those 0’s and 1’s. expres- sions Examples of file extextensions: png, jpg, py, doc, txt, cpp grep Ex2 http://www.clker.com/cliparts/U/F/n/1/i/2/binary-file-md.png More What is the file system? Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- Tree structure (for each partition in disc) sions grep It contains folders and files Ex2 http://cdn.ttgtmedia.com/rms/onlineImages/TT_tree_desktop.jpg More Linux file system? Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More Basic linux terminal commands Python Olmo S. Zavala Romero Welcome Computers File system Commands WHERE TO PRACTICE OUTSIDE THE CLASSROOM: man http://www.webminal.org/ pwd https://www.tutorialspoint.com/unix_terminal_online.php ls cd 1 man Shows the documentation of other terminal commands. mkdir 2 pwd Shows the current position in the terminal. touch rm 3 ls List the files and folders and its information. mv 4 cd Moves within the file system tree structure. Ex1 Regular 5 mkdir Creates directories. expres- 6 touch Creates files. sions grep 7 rm Removes files (and directories). Ex2 8 cp Copies files and folders to other locations. More 9 mv Moves files and folders to other locations. 10 grep Searches for files and folders. https://teentechdaily.files.wordpress.com/2015/06/computer-parts-diagram.jpg man Python An interface to the on-line reference manuals Olmo S. Zavala 1 Inside the manual page use: Romero h For help Welcome j Down Computers k Up File system space Forward one window w Backward one window Commands /pattern Search pattern inside manual man pwd G Go to the end ls q Quit cd Examples: mkdir touch rm man command # Shows the reference manual of command mv man -f command # Summary of the command Ex1 man -help # Help for the man command Regular expres- sions grep Ex2 More pwd Python Prints name of current directory Olmo S. Zavala Examples: Romero Welcome pwd #:) Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More ls Python List directory contents Olmo S. Zavala It can use Globbing for file expansion. Check this website: LINK. Romero Examples: Welcome Computers ls # Lists files and folders File system ls -a # Lists also hidden files(what are hidden files?) ls folder # Lists content of specific folder Commands ls -l # List in vertically man pwd ls *.txt # List all files that end with.txt ls ls Important* # List all files that start with important cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More cd Python Change the working directory Olmo S. Zavala Examples: Romero Welcome cd folder # Move to the specified folder cd .. # Move one folder up in the tree Computers cd ˜ # Move the user HOME folder File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More mkdir Python Make directories Olmo S. Zavala Examples: Romero Welcome mkdir folderName # Creates the directory folderName Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More touch Python Simple way to make text files (if the file exists, it updates its timestamp) Olmo S. Zavala Examples: Romero Welcome touch file.txt # Creates the file file.txt Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More rm Python Remove files or directories Olmo S. Zavala It can use Globbing for file expansion. Check this website: LINK. Romero Examples: Welcome Computers rm file # Removes the specified file File system rm -r folder # Removes the specified folder and all its files rm *.txt # Removes all the files that end with.txt Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More mv Python Move or rename files and folders Olmo S. Zavala It can use Globbing for file expansion. Check this website: LINK. Romero Examples: Welcome Computers mv fileOrigin fileDest # Moves fileOrigin as fileDest File system mv -b fileOrigin fileDest # Makea backup if fileDest already exists mv *.txt folder # Moves all the.txt files intoa different folder Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More 2 Move Two.txt into the Thesis folder with the name Three.txt 3 Move the folder Data into a new directory called RootData 4 Delete the Tools folder 5 Rename the Thesis folder to DoneThesis 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular expres- sions grep Ex2 More 3 Move the folder Data into a new directory called RootData 4 Delete the Tools folder 5 Rename the Thesis folder to DoneThesis 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular 2 Move Two.txt into the Thesis folder with the name Three.txt expres- sions grep Ex2 More 4 Delete the Tools folder 5 Rename the Thesis folder to DoneThesis 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular 2 Move Two.txt into the Thesis folder with the name Three.txt expres- sions 3 Move the folder Data into a new directory called RootData grep Ex2 More 5 Rename the Thesis folder to DoneThesis 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular 2 Move Two.txt into the Thesis folder with the name Three.txt expres- sions 3 Move the folder Data into a new directory called RootData grep 4 Delete the Tools folder Ex2 More 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular 2 Move Two.txt into the Thesis folder with the name Three.txt expres- sions 3 Move the folder Data into a new directory called RootData grep 4 Delete the Tools folder Ex2 More 5 Rename the Thesis folder to DoneThesis Excercises Python Olmo S. Zavala Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 1 Copy One.txt inside Format folder Regular 2 Move Two.txt into the Thesis folder with the name Three.txt expres- sions 3 Move the folder Data into a new directory called RootData grep 4 Delete the Tools folder Ex2 More 5 Rename the Thesis folder to DoneThesis 6 Move to the Stats folder, from there copy Three.txt (inside DoneThesis) into the Old folder with the name OldThree.csv. Regular expressions Python Regular expressons are a way to do pattern matching. We use them to find Olmo S. Zavala specif strings within a text. Romero Welcome Computers File system Commands man pwd ls cd mkdir touch rm mv Ex1 Regular expres- sions grep Ex2 More http://ryanstutorials.net/linuxtutorial/grep.php grep Python Searches input files for lines containing a match to the given pattern (or Olmo S.