
Un*x for dummies Basics of Command Line Interface… Vincent Lafage Ivana Hrivnacova 1Computing department, IJCLab Université Paris-Saclay January 6, 2021 . 1 / 17 Linux Screenshot . 2 / 17 File A computer file 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 & time • last modification date & time • attributes . 3 / 17 Files extension… • text files ) .txt or no extension • source code files ) .cpp/.cxx/.C, .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 Directory also known as folder files are keptL in directories there are subdirectories in directories ) folders form a hierarchy, or tree structure of one or more levels $ mkdir new_directory ) create a new directory called new_directory in the current directory $ rmdir 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 cd 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: $ pwd ) Where am I? … in which directory: Path to Working Directory $ whoami ) Who 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 $ ls ) shows all files in the current directory • ls has a LOT of options… displaying file contents $ cat HOWTO ) dumps HOWTO file’s content to the screen $ more HOWTO ) “pages” HOWTO file’s content to the screen $ less HOWTO ) “pages” HOWTO file’s content to the screen . 11 / 17 example (3) . 12 / 17 Basic file management (2) copying, renaming & moving, deleting files $ cp HOWTO HOWTO.original ) CoPy file HOWTO in new file HOWTO.original $ rm HOWTO ) ReMove (delete) file HOWTO $ mv HOWTO.original HOWTO ) MoVe (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 $ grep 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 $ find . -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.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-