Un*x for dummies Basics of Line Interface…

Vincent Lafage Ivana Hrivnacova

1Computing department, IJCLab Université Paris-Saclay

January 6, 2021 ...... 1 / 17 Screenshot

...... 2 / 17 A is a block of arbitrary information data: • contents ⇒ characters (encoding) …& metadata: • file’s name under Mac/Linux, filenames are CASE-SENSITIVE!!! isotope.cxx is NOT Isotope.cxx • file’s extension • file’s size (how many characters, bytes or kilobytes or megabytes…) • creation date & • last modification date & time • attributes ...... 3 / 17 Files extension…

• text files ⇒ .txt or no extension • source code files ⇒ .cpp/.cxx/., .c, .h/.hpp/.hxx/.H, .pl, .py, .f, .f90, .cob, .adb, .ads… • email files ⇒ .eml • web page files ⇒ .htm, .html, .php… • LATEX file ⇒ .tex • binary files • image file ⇒ .png, .jpg, .gif,… • movie file ⇒ .mpg, .avi,… • document file ⇒ .pdf, .doc, .odt,… • executable files ⇒ .exe or no extension

...... 4 / 17 also known as folder

files are kept⊕ in directories there are subdirectories in directories ⇒ folders form a hierarchy, or structure of one or levels

$ new_directory ⇒ create a new directory called new_directory in the current directory $ old_directory ⇒ delete old_directory $ mkdir -p www/logs ⇒ create logs subdirectory of www directory, and if needed create www as well.

...... 5 / 17 Moving across directories

directory_name $ cd directory ⇒ goes to directory called directory (you can go directly to a subdirectory) • special directories: • . current • .. parent • ̃ home (the default directory when you log in, where all your files are) philosophical questions: $ ⇒ Where am I? … in directory: Path to $ am I?

...... 6 / 17 Executable files

$ program ⇒ execute the executable file called program $ ./program ⇒ …and stored in the current directory $ open application ⇒ …only on Mac

...... 7 / 17 example

...... 8 / 17 example (2)

...... 9 / 17 example (2b)

...... 10 / 17 Basic file management

displaying directory contents $ ⇒ shows all files in the current directory • ls has a LOT of options… displaying file contents $ HOWTO ⇒ dumps HOWTO file’s content to the screen $ more HOWTO ⇒ “pages” HOWTO file’s content to the screen $ HOWTO ⇒ “pages” HOWTO file’s content to the screen

...... 11 / 17 example (3)

...... 12 / 17 Basic file management (2)

copying, renaming & moving, deleting files $ HOWTO HOWTO.original ⇒ file HOWTO in new file HOWTO.original $ HOWTO ⇒ ReMove (delete) file HOWTO $ HOWTO.original HOWTO ⇒ (rename) file HOWTO.original as HOWTO $ mv HOWTO SubDirectory ⇒ MoVe file HOWTO from current directory to SubDirectory

...... 13 / 17 example (4)

...... 14 / 17 Basic file management (3)

finding documentation $ man ls ⇒ displays documentation of ls command $ man man ⇒ …man command searching file contents $ version HOWTO ⇒ looks for occurence of character string version in HOWTO file’s content $ grep -i version HOWTO ⇒ …in a case-insensitive way $ grep -r version . ⇒ …in all files of the current directory and sub-directories $ . -iname howto ⇒ looks for all files called “howto”, in a case insensitive way, in the current directory & recursively in all of its subdirectories

...... 15 / 17 Basic file management (3b)

...... 16 / 17 Thank you for your attention

Questions?

...... 17 / 17