0% found this document useful (0 votes)
13 views35 pages

3 Linux

Uploaded by

majir61269
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views35 pages

3 Linux

Uploaded by

majir61269
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Linux

T: +27 51 401 9111 | E: [email protected] | www.ufs.ac.za


Contents
• Introduction
• Linux User Interfaces
• Linux File System
• Linux Terminal Demonstration
Introduction
Linux
• Unix-like operating system
• GNU/Linux
⚫ GNU system packages with Linux Kernel

• Standard operating system for HPC / Servers / etc.


• Community driven, open-source and free to use and distribute
• Thus, many flavors or distributions
Linux Advantages & Disadvantages
• Advantages
⚫ Free to use and distribute

⚫ Bugs are found and fixed quicker

⚫ Transparency natural fit for scientists

• Disadvantages
⚫ Software compilation – not user friendly

⚫ Not Windows
Linux Distributions
• Linux Mint (https://linuxmint.com/)

• Pop!_OS (https://pop.system76.com/)

• Fedora (https://getfedora.org/)

• Ubuntu (https://ubuntu.com/)

• Hanna Montana Linux (http://hannahmontana.sourceforge.net/)


Linux User Interfaces
Linux User Interfaces
• Two main types
⚫ Graphical User Interface (GUI)

⚫ Text Interface (Terminal)

• Main HPC interface → Text Interface


Linux GUIs
• Many options
• Desktop Managers
⚫ GNOME

⚫ KDE Plasma

⚫ XFCE

⚫ Cinnamon

⚫ ETC
Linux Mint with Cinnamon
Garuda Linux with KDE Plasma
Rocky Linux with GNOME3
Terminal – Terminal Emulators
Linux File System
Linux File system
• File System
⚫ Collection of methods OS uses to manage data on a storage device such as hard
disks
• Partition Types:
⚫ NTFS, FATx (Microsoft)
⚫ Ext4 (Linux)
⚫ HFS (Apple)
• Windows can only read NTFS and FATx partition / not Ext4
• Linux can read most partition types
• Files and directories organized differently from Windows
Windows File System
Windows File System
Linux File system
• All storage devices amalgamated into one root file system
• Top directory --> Root or /
• Storage devices mounted in directories within /
• Home directories --> / home / <username>
⚫ Users have full permissions in their own home directories
⚫ No write permissions in system directories
⚫ More secure
• File extensions for your convenience and not important in Linux
Linux File system
Linux File system
Linux File system
File and directory paths

Windows Linux

I: \ Fantasy /media/leon/MOVIES/Fantasy

Drive Directory Directory mount point Directory


Letter
Linux Terminal Demonstration
Introduction
• Use terminal commands to navigate and perform actions
• Each terminal command is usually a stand-alone program
• Common interfaces with most CLI commands / programs
⚫ Positional arguments: cp <source> <destination>
⚫ Options/Flags can be in long form or short hand
⚫ Long form: --help
⚫ Short hand: -h
⚫ Using (-h) or (--help) --> most cases --> show how to use command/program
⚫ Using man <command> will display the command’s manual
Navigation in the Linux
• Short-cuts:
⚫ / : Root Directory
⚫ . : Present Working Directory (PWD)
⚫ .. : One directory above the PWD
⚫ ~ : Home directory for the current user
⚫ - : Previous directory (only used with cd)
• pwd
• ls
• cd
• find
Performing File Operations
• mkdir

• touch

• cp

• mv

• rm
Viewing File Contents
• cat

• more

• less

• head

• tail
Miscellaneous Commands
• tar

• screen
Regular Expressions
• Patterns that match strings

• Can become complex very quickly → gentle introduction

• Steps for crafting a regular expression:

• Identify common patterns

• Write the regular expression based on common pattern

• Test the regular expression


Identifying Patterns
• Example: The following files are generated by an experiment:
• foo_stats.txt
• foo_seq1.fasta
• foo_seq2.fasta
• foo_seq3.fasta
• foo_timings.fasta
• hpc_job.error
• hpc_job.output
• hpc_job.nodes
• hpc_job.txt
Regular Expressions
• Example: The following files are generated by an experiment:
• foo_stats.txt
• foo_seq1.fasta
• foo_seq2.fasta
• foo_seq3.fasta
• foo_timings.fasta
• hpc_job.error
• hpc_job.output
• hpc_job.nodes
• hpc_job.txt
Regular Expressions
• Example: The following files are generated by an experiment:
• foo_stats.txt
• foo_seq1.fasta
• foo_seq2.fasta
• foo_seq3.fasta
• foo_timings.fasta
• hpc_job.error
• hpc_job.output
• hpc_job.nodes
• hpc_job.txt
Regular Expressions
• Example: The following files are generated by an experiment:
• foo_stats.txt
• foo_seq1.fasta
• foo_seq2.fasta
• foo_seq3.fasta
• foo_timings.fasta
• hpc_job.error
• hpc_job.output
• hpc_job.nodes
• hpc_job.txt
Writing regular expressions
Element Definition Example
Character set or class Characters retaining their The prefix foo
literal meaning
Modifiers Expand or narrow the Asterisk (*) expands
text to match selection to all characters
Anchors Indicates the location Caret (^) indicates that
from where to match the pattern should be at
the beginning of the text

* Note that Anchors can only be used with tools such as grep and sed
Writing regular expressions - Example
• List all files that start with the prefix foo

• $ ls foo*

• List all files that end with the .fasta extension

• $ ls *.fasta

• Copy all files that start with the prefix hpc_job

• $ cp hpc_job* new_directory

You might also like