This document provides a tutorial on Unix/Linux. It begins with an overview of the Unix system including the kernel, shell, multi-user and multi-process capabilities, and important directory structures. It then covers basic commands, relative and absolute paths, redirecting and piping output, permissions, process management, installing software, text editors, running jobs in the foreground and background, and remote login/file transfer. The goal is to introduce fundamental Unix concepts and commands to new users.
The document discusses Linux commands for file management and viewing. It describes commands for navigating directories (cd), changing file permissions (chmod), copying files (cp), finding files (find), listing directory contents (ls), creating and removing directories (mkdir, rmdir), moving and renaming files (mv), viewing file contents (cat, head, tail), comparing files (cmp, diff), searching files (grep), and more. It also covers commands for compressing, archiving, and backing up files like tar, gzip, zip, and commands for counting, sorting, and filtering file contents.
The document summarizes the usage of various Linux commands like cd, bc, man, who, whoami, pwd, mkdir, rmdir, ls, touch, mv, date, cat, more, less, print, echo, lp, rm, cp and their options. It provides the syntax and examples of using each command. The commands covered are for directory navigation, file manipulation, text processing and printing files in Linux operating system.
The document discusses Linux commands for file management, viewing and shell programming. It describes common commands like ls, cd, cp, mv, rm, mkdir which allow navigating and manipulating files and directories. It also covers commands for viewing file contents like cat, head, tail, grep. Commands for compression like tar, gzip, zip and decompression like gunzip, unzip are mentioned. The document also has a section on shell programming which explains how to write shell scripts using commands and variables. It provides examples of using pipes, redirections and command options.
This document provides an overview of the Unix operating system and some basic Unix commands. It discusses the kernel and shell architecture of Unix, the multi-user and multi-process capabilities, file and directory structures including important directories like /bin, /home, and /var. It also summarizes common commands for navigating directories, viewing files, copying/moving files, and managing permissions and processes. The document is intended to help users get started with basic Unix concepts and commands.
This document provides an overview of the UNIX operating system and basic UNIX commands. It discusses why knowledge of UNIX is useful for testers, the multi-user and multi-tasking capabilities of UNIX, and common commands for navigating files and directories, manipulating text, and viewing processes. The document also summarizes UNIX file system structure, permissions, and compression/filtering commands like grep, sort, cut, and diff.
This document provides an overview of the UNIX operating system and basic UNIX commands. It discusses why knowledge of UNIX is useful for testers, outlines some key features of UNIX like multi-user capability and security, and describes common commands for navigating the file system, manipulating files and directories, filtering output, and running processes in the background. The document is intended as an introduction to UNIX for testers and newcomers to help increase their job opportunities.
This document provides instructions for 27 common Linux commands: mkdir, rmdir, ls, cd, cat, touch, wc, who, pwd, rm, mv, chmod, cp, grep, cal, date, vi, tput, ps, export, type, tail, sudo, head, man, clear, and adduser. For each command, it lists the syntax and provides 1-3 examples of common uses. The document is presented over 28 pages with the commands organized topic-by-topic and includes formatting like headings and indentation to aid readability.
This document provides an overview of system administrator tasks and basic UNIX concepts. It discusses the roles and responsibilities of system administrators, the structure and components of UNIX operating systems, basic commands for navigating the file system, managing files and directories, editing text, and running processes. It also covers shells, variables, and cron jobs for scheduling automated tasks. The document concludes with introductions to AIX operating systems and IBM pSeries servers.
Linux is an open source operating system initially created by Linus Torvalds in 1991. It has since grown significantly with hundreds of companies and individuals developing their own versions based on the Linux kernel. The kernel is developed under the GNU GPL license and its source code is freely available. Basic Linux commands allow users to navigate directories, manage files and permissions, transfer files, and get system information. More advanced commands provide additional control and functionality.
This document provides an overview of shell scripting. It begins with an agenda that covers introducing UNIX/Linux and shell, basic shell scripting structure, shell programming with variables, operators, and logic structures. It then gives examples of shell scripting applications in research computing and concludes with hands-on exercises. The document discusses the history and architecture of UNIX/Linux, commonly used shells like bash and csh, and why shell scripting is useful for tasks like preparing input files, job monitoring, and output processing. It also covers basic UNIX commands, commenting in scripts, and debugging strategies.
The document provides an overview of various operating systems including UNIX, Linux, and Windows. It discusses the history and development of UNIX including early projects at Bell Labs and Berkeley. It also summarizes key features of UNIX such as security, reliability, and multi-user support. The document then describes the UNIX directory structure and common commands like ls, cd, cat, and man.
Linux is an open-source operating system based on Unix, designed for multi-user environments. The document provides an overview of basic Linux commands like ls, mkdir, cd for navigating files and directories, as well as more advanced commands for manipulating files, checking system resources, and getting system information. It also lists and describes many common Linux commands and their functions.
This document provides 50 examples of common Linux/Unix commands organized by command name. It begins with tar, grep, find, ssh, sed, awk, vim, diff, sort, and export examples. The document is intended as a quick reference for users to learn practical uses of fundamental Linux commands.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key points are:
- LAMP is an open source software solution stack using Linux, Apache, MySQL, and PHP.
- Linux commands allow users to navigate files/folders, view processes, manage users, and more.
- Linux directories include /, /boot, /bin, /lib, /usr for storing system and user files and apps.
- Cron jobs allow scheduling commands to run periodically using a crontab file.
The document provides an overview of Linux operating system concepts including:
- Linux is an open source operating system that interacts with hardware and allocates resources.
- It supports multi-tasking and multi-user environments. Common types include Debian, Ubuntu, and Redhat.
- Key components include the kernel, shell programs, file management commands, text editors, browsers, and programming tools.
This document provides an introduction to Linux and its components. It discusses that Linux is an operating system like Windows and Mac OS that manages communication between hardware and software. It then outlines the course curriculum which will cover topics such as the Linux kernel, shell, commands, file system, permissions and networking tools. Several sections then provide more detail on key aspects of Linux including what an operating system is, the parts of an operating system like the kernel and shell, and why Linux is widely used and advantageous over other operating systems.
Linux is an open source operating system created by Linus Torvalds in 1991. It uses a Linux kernel and includes many common Unix tools. Linux is free to use and modify due to its open source licensing. It runs on many hardware platforms and is growing in popularity for servers, desktops, and embedded systems due to its low cost, stability, and security. Users can download Linux from distributions like Red Hat which package the Linux kernel with additional software and support.
The document provides information about an upcoming UNIX and Shell Scripting workshop, including contact information for the workshop instructor R. Chockalingam, and covers topics that will be discussed such as the architecture and components of the UNIX operating system, basic UNIX commands, text editors, the file system structure, flags and arguments, and more.
This document provides an introduction and overview of the UNIX operating system. It discusses that UNIX is an operating system, like Windows, that manages communication between software and hardware. Popular versions of UNIX include Linux and Android. The document outlines reasons for using UNIX such as reliability, low/no cost, and open source access. It describes the core components of UNIX including the kernel, bootloader, daemons, and shells. Key features like being portable, multi-user, and providing security are highlighted. Common UNIX commands and utilities are listed along with file permissions, redirection, pipes, and filters.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key points include:
- LAMP is an open source software solution stack using Linux, Apache, MySQL, and PHP. It allows for easy coding and deployment of PHP applications.
- Linux commands covered include cd, ls, pwd, touch, rm. Directories include /, /boot, /bin, /usr, /var. Editors discussed are vi and emacs.
- Cron jobs allow scheduling commands to run on a set schedule using crontab files. Syntax includes minutes, hours, day of month, month
The document provides an overview of common Linux commands organized into categories, with brief explanations of each command. It covers commands for working with files and directories (ls, cd, cp, rm), processes (ps, top, kill), networking (ping, ifconfig), file archiving and compression (tar, gzip), and more. It also lists important directories in the Linux file system such as /bin, /usr/bin, /etc, and directories under /usr.
Linux is a prominent example of free and open source software. It can be installed on a wide variety of devices from embedded systems to supercomputers. Linux is commonly used for servers, with estimates that it powers around 60% of web servers. Linux distributions package the Linux kernel with other software like utilities, libraries and desktop environments. Programming languages and build tools like GCC are supported. Embedded Linux is often used in devices due to its low cost and ease of modification.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key details include that LAMP is an open source software stack using these components, Linux commands allow managing files and systems, directories structure the Linux filesystem, vi and cron are tools for text editing and automated tasks.
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study MaterialJenny408767
油
Pass SAP C_C4H47_2503 with expert-designed practice tests & real questions. Start preparing today with ERPPrep.com and boost your SAP Sales Cloud career!
Unit1 Inroduction to Internal Combustion EnginesNileshKumbhar21
油
Introduction of I. C. Engines, Types of engine, working of engine, Nomenclature of engine, Otto cycle, Diesel cycle Fuel air cycles Characteristics of fuel - air mixtures Actual cycles, Valve timing diagram for high and low speed engine, Port timing diagram
More Related Content
Similar to OS-Module 2 Linux Programming Important topics (20)
This document provides an overview of the UNIX operating system and basic UNIX commands. It discusses why knowledge of UNIX is useful for testers, outlines some key features of UNIX like multi-user capability and security, and describes common commands for navigating the file system, manipulating files and directories, filtering output, and running processes in the background. The document is intended as an introduction to UNIX for testers and newcomers to help increase their job opportunities.
This document provides instructions for 27 common Linux commands: mkdir, rmdir, ls, cd, cat, touch, wc, who, pwd, rm, mv, chmod, cp, grep, cal, date, vi, tput, ps, export, type, tail, sudo, head, man, clear, and adduser. For each command, it lists the syntax and provides 1-3 examples of common uses. The document is presented over 28 pages with the commands organized topic-by-topic and includes formatting like headings and indentation to aid readability.
This document provides an overview of system administrator tasks and basic UNIX concepts. It discusses the roles and responsibilities of system administrators, the structure and components of UNIX operating systems, basic commands for navigating the file system, managing files and directories, editing text, and running processes. It also covers shells, variables, and cron jobs for scheduling automated tasks. The document concludes with introductions to AIX operating systems and IBM pSeries servers.
Linux is an open source operating system initially created by Linus Torvalds in 1991. It has since grown significantly with hundreds of companies and individuals developing their own versions based on the Linux kernel. The kernel is developed under the GNU GPL license and its source code is freely available. Basic Linux commands allow users to navigate directories, manage files and permissions, transfer files, and get system information. More advanced commands provide additional control and functionality.
This document provides an overview of shell scripting. It begins with an agenda that covers introducing UNIX/Linux and shell, basic shell scripting structure, shell programming with variables, operators, and logic structures. It then gives examples of shell scripting applications in research computing and concludes with hands-on exercises. The document discusses the history and architecture of UNIX/Linux, commonly used shells like bash and csh, and why shell scripting is useful for tasks like preparing input files, job monitoring, and output processing. It also covers basic UNIX commands, commenting in scripts, and debugging strategies.
The document provides an overview of various operating systems including UNIX, Linux, and Windows. It discusses the history and development of UNIX including early projects at Bell Labs and Berkeley. It also summarizes key features of UNIX such as security, reliability, and multi-user support. The document then describes the UNIX directory structure and common commands like ls, cd, cat, and man.
Linux is an open-source operating system based on Unix, designed for multi-user environments. The document provides an overview of basic Linux commands like ls, mkdir, cd for navigating files and directories, as well as more advanced commands for manipulating files, checking system resources, and getting system information. It also lists and describes many common Linux commands and their functions.
This document provides 50 examples of common Linux/Unix commands organized by command name. It begins with tar, grep, find, ssh, sed, awk, vim, diff, sort, and export examples. The document is intended as a quick reference for users to learn practical uses of fundamental Linux commands.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key points are:
- LAMP is an open source software solution stack using Linux, Apache, MySQL, and PHP.
- Linux commands allow users to navigate files/folders, view processes, manage users, and more.
- Linux directories include /, /boot, /bin, /lib, /usr for storing system and user files and apps.
- Cron jobs allow scheduling commands to run periodically using a crontab file.
The document provides an overview of Linux operating system concepts including:
- Linux is an open source operating system that interacts with hardware and allocates resources.
- It supports multi-tasking and multi-user environments. Common types include Debian, Ubuntu, and Redhat.
- Key components include the kernel, shell programs, file management commands, text editors, browsers, and programming tools.
This document provides an introduction to Linux and its components. It discusses that Linux is an operating system like Windows and Mac OS that manages communication between hardware and software. It then outlines the course curriculum which will cover topics such as the Linux kernel, shell, commands, file system, permissions and networking tools. Several sections then provide more detail on key aspects of Linux including what an operating system is, the parts of an operating system like the kernel and shell, and why Linux is widely used and advantageous over other operating systems.
Linux is an open source operating system created by Linus Torvalds in 1991. It uses a Linux kernel and includes many common Unix tools. Linux is free to use and modify due to its open source licensing. It runs on many hardware platforms and is growing in popularity for servers, desktops, and embedded systems due to its low cost, stability, and security. Users can download Linux from distributions like Red Hat which package the Linux kernel with additional software and support.
The document provides information about an upcoming UNIX and Shell Scripting workshop, including contact information for the workshop instructor R. Chockalingam, and covers topics that will be discussed such as the architecture and components of the UNIX operating system, basic UNIX commands, text editors, the file system structure, flags and arguments, and more.
This document provides an introduction and overview of the UNIX operating system. It discusses that UNIX is an operating system, like Windows, that manages communication between software and hardware. Popular versions of UNIX include Linux and Android. The document outlines reasons for using UNIX such as reliability, low/no cost, and open source access. It describes the core components of UNIX including the kernel, bootloader, daemons, and shells. Key features like being portable, multi-user, and providing security are highlighted. Common UNIX commands and utilities are listed along with file permissions, redirection, pipes, and filters.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key points include:
- LAMP is an open source software solution stack using Linux, Apache, MySQL, and PHP. It allows for easy coding and deployment of PHP applications.
- Linux commands covered include cd, ls, pwd, touch, rm. Directories include /, /boot, /bin, /usr, /var. Editors discussed are vi and emacs.
- Cron jobs allow scheduling commands to run on a set schedule using crontab files. Syntax includes minutes, hours, day of month, month
The document provides an overview of common Linux commands organized into categories, with brief explanations of each command. It covers commands for working with files and directories (ls, cd, cp, rm), processes (ps, top, kill), networking (ping, ifconfig), file archiving and compression (tar, gzip), and more. It also lists important directories in the Linux file system such as /bin, /usr/bin, /etc, and directories under /usr.
Linux is a prominent example of free and open source software. It can be installed on a wide variety of devices from embedded systems to supercomputers. Linux is commonly used for servers, with estimates that it powers around 60% of web servers. Linux distributions package the Linux kernel with other software like utilities, libraries and desktop environments. Programming languages and build tools like GCC are supported. Embedded Linux is often used in devices due to its low cost and ease of modification.
The document provides information about the LAMP stack and its components - Linux, Apache, MySQL, and PHP. It then discusses Linux commands, directories, editors, and scheduling tasks using cron jobs. Key details include that LAMP is an open source software stack using these components, Linux commands allow managing files and systems, directories structure the Linux filesystem, vi and cron are tools for text editing and automated tasks.
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study MaterialJenny408767
油
Pass SAP C_C4H47_2503 with expert-designed practice tests & real questions. Start preparing today with ERPPrep.com and boost your SAP Sales Cloud career!
Unit1 Inroduction to Internal Combustion EnginesNileshKumbhar21
油
Introduction of I. C. Engines, Types of engine, working of engine, Nomenclature of engine, Otto cycle, Diesel cycle Fuel air cycles Characteristics of fuel - air mixtures Actual cycles, Valve timing diagram for high and low speed engine, Port timing diagram
Different Facets of Knowledge on different View.pptxNrapendraVirSingh
油
Knowledge is a fundamental aspect of human understanding, evolving through different dimensions and perspectives. The nature of knowledge varies depending on its scope, application, and contextual relevance. In this lecture, we explore four key distinctions in knowledge: Particular vs. Universal, Concrete vs. Abstract, Practical vs. Theoretical, and Textual vs. Contextual. Each of these dichotomies helps us comprehend how knowledge is categorized, interpreted, and applied across different fields of study.
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Sue Beckingham
油
This presentation explores the role of generative AI (GenAI) in enhancing the Scholarship of Teaching and Learning (SoTL), using Feltens five principles of good practice as a guiding framework. As educators within higher education institutions increasingly integrate GenAI into teaching and research, it is vital to consider how these tools can support scholarly inquiry into student learning, while remaining contextually grounded, methodologically rigorous, collaborative, and appropriately public.
Through practical examples and case-based scenarios, the session demonstrates how generative GenAI can assist in analysing critical reflection of current practice, enhancing teaching approaches and learning materials, supporting SoTL research design, fostering student partnerships, and amplifying the reach of scholarly outputs. Attendees will gain insights into ethical considerations, opportunities, and limitations of GenAI in SoTL, as well as ideas for integrating GenAI tools into their own scholarly teaching practices. The session invites critical reflection and dialogue about the responsible use of GenAI to enhance teaching, learning, and scholarly impact.
This presentation was provided by Lettie Conrad of LibLynx and San Jos辿 University during the initial session of the NISO training series "Accessibility Essentials." Session One: The Introductory Seminar was held April 3, 2025.
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...Amlan Sarkar
油
Prelims (with answers) + Finals of a general quiz originally conducted on 9th February, 2025.
This was the closing quiz of the 2025 edition of ChakraView - the annual quiz fest of Ashoka University.
Feedback welcome at amlansarkr@gmail.com
Recruitment in the Odoo 17 - Odoo 17 際際滷sCeline George
油
It is a sad fact that finding qualified candidates for open positions has grown to be a challenging endeavor for an organization's human resource management. In Odoo, we can manage this easily by using the recruitment module
How to Setup Company Data in Odoo 17 Accounting AppCeline George
油
The Accounting module in Odoo 17 is a comprehensive tool designed to manage all financial aspects of a business. It provides a range of features that help with everything from day-to-day bookkeeping to advanced financial analysis.
All India Council of Vocational Skills (AICSVS) and National Council of Open Schooling Research and Training (NCOSRT), Global International University, Asia Book of World Records (ABWRECORDS), International a joint Accreditation Commission of Higher Education (IACOHE)The prospectus is going to be published in the year 2025
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷sCeline George
油
In this slide well discuss the installation of odoo 18 with pycharm. Odoo 18 is a powerful business management software known for its enhanced features and ability to streamline operations. Built with Python 3.10+ for the backend and PostgreSQL as its database, it provides a reliable and efficient system.
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VISamruddhi Khonde
油
Antiviral agents are crucial in combating viral infections, causing a variety of diseases from mild to life-threatening. Developed through medicinal chemistry, these drugs target viral structures and processes while minimizing harm to host cells. Viruses are classified into DNA and RNA viruses, with each replicating through distinct mechanisms. Treatments for herpesviruses involve nucleoside analogs like acyclovir and valacyclovir, which inhibit the viral DNA polymerase. Influenza is managed with neuraminidase inhibitors like oseltamivir and zanamivir, which prevent the release of new viral particles. HIV is treated with a combination of antiretroviral drugs targeting various stages of the viral life cycle. Hepatitis B and C are treated with different strategies, with nucleoside analogs like lamivudine inhibiting viral replication and direct-acting antivirals targeting the viral RNA polymerase and other key proteins.
Antiviral agents are designed based on their mechanisms of action, with several categories including nucleoside and nucleotide analogs, protease inhibitors, neuraminidase inhibitors, reverse transcriptase inhibitors, and integrase inhibitors. The design of these agents often relies on understanding the structure-activity relationship (SAR), which involves modifying the chemical structure of compounds to enhance efficacy, selectivity, and bioavailability while reducing side effects. Despite their success, challenges such as drug resistance, viral mutation, and the need for long-term therapy remain.
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...coreylewis960
油
Marketing is Everything in the Beauty Business! 憓
Talent gets you in the gamebut visibility keeps your chair full.
Todays top stylists arent just skilledtheyre seen.
Thats where MyFi Beauty comes in.
We Help You Get Noticed with Tools That Work:
Social Media Scheduling & Strategy
We make it easy for you to stay consistent and on-brand across Instagram, Facebook, TikTok, and more.
Youll get content prompts, captions, and posting tools that do the work while you do the hair.
ワ Your Own Personal Beauty App
Stand out from the crowd with a custom app made just for you. Clients can:
Book appointments
Browse your services
View your gallery
Join your email/text list
Leave reviews & refer friends
種 Offline Marketing Made Easy
We provide digital flyers, QR codes, and branded business cards that connect straight to your appturning strangers into loyal clients with just one tap.
ッ The Result?
You build a strong personal brand that reaches more people, books more clients, and grows with you. Whether youre just starting out or trying to level upMyFi Beauty is your silent partner in success.
3. teachics.org
Introduction
Shell is an environment in which we can run our commands, programs, and
shell scripts.
It gathers input from you and executes programs based on that input. When
a program finishes executing, it displays that program's output.
- kernal = core of a computers operating system
- terminal = text input/output environment
- shell = command line interpreter
- shell scripts = commands written in a file
4. teachics.org
Shells Available in Unix
- C shell (csh)
- TC shell (tcsh)
- Bourne shell (sh)
- Korn shell (ksh)
- Bourne Again Shell (bash)
Bourne Again Shell (bash)
Bash is the default shell in most Linux distributions.Bash offers functional
improvements over sh for both programming and interactive use.
5. teachics.org
Special Characters
Comments-Lines beginning with a # (with the exception of #!) will not be executed.
# This line is a comment.
; Command separator. Permits putting two or more commands on the same line.
echo hello ; echo world
;; Terminator in a case option
case "$variable" in
abc) echo "$variable = abc" ;;
xyz) echo "$variable = xyz" ;;
esac
` command substitution. The `command` construct makes available the output of
command for assignment to a variable
6. teachics.org
Special Characters
$ Variable substitution (contents of a variable)
$(variable)
Weak quotes
echo hello world
Strong quotes
echo hello world
Single character quote
7. teachics.org
Getting help
The help command provides information on built-in commands.
simply entering help at the terminal prompt will show a complete list of the built-in
commands available.
enter help followed by the command you wish to learn more about.
help pwd
With the -d option, the help command will only return a short description of the specified
command.
help -d pwd
With the -s option, help will return a short usage synopsis for the specified command.
help -s pwd
The -m option formats the help command output as a pseudo-manpage.
help -m pwd
8. teachics.org
man pages
The man command shows detailed manuals for each command. These are referred to as man
pages.
It provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION,
OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS ..etc
man pwd
11. teachics.org
Commands for navigating the Linux file system
pwd - prints the complete path of the current working directory.
pwd -L : Prints the symbolic path.
pwd -P : Prints the actual path.
cd - change the current working directory.
cd [directory]
ls - list of the names of all files in the current working directory / specified directory.
ls
ls /etc
file - displays the type of a file.
file [option] [filename]
file -b filename : used to display just file type in brief mode.
file directoryname/* : used to display all files filetypes in particular directory.
12. teachics.org
Commands for navigating the Linux file system
cat read and concatenate data from the file and gives their content as output.
cat filename read single filename
cat file1 file2 show contents of file1 and file2
cat -n file show contents of fille with preceding line number
cat -s file suppress repeated empty lines in output
cp - copy fiiles or directories from source to destination
cp Src_file Dest_file copy the contents of src_file to the dest_file
cp Src_file1 Src_file2 Src_file3 Dest_directory copies each source file to the destination directory
cp -R Src_directory Dest_directory copies all files of the source directory to the destination directory, creating any files or directories
needed
mv - move fiiles or directories from source to destination
mv Src_file Dest_file move the file src_file to the dest_file
mv -i Src_file Dest_directory ask the user for confirmation before moving a file that would overwrite an existing file,
mv -f Src_directory Dest_directory overwrite the destination file forcefully and delete the source file.
13. teachics.org
Commands for navigating the Linux file system
mkdir - create multiple directories at once as well as set the permissions for the directories
mkdir foldername
mkdir -m 777 foldername used to set the file modes
rmdir - remove empty directories from the filesystem
rmdir -p directory remove directory if it is empty
rmdir -p directory remove all child and parent empty directories
rmdir directorylist remove all directories
whereis - locates source/binary and manuals sections for specified files.
whereis perl List the directories where the perl source files, documentation, and binaries are stored.
whereis -b perl List only perl binaries are stored.
whereis -s perl List only perl sources are stored.
whereis -m perl List only perl manuals are stored.
14. teachics.org
Piping and Redirection
Every program we run on the command line automatically has three data streams connected
to it.
STDIN (0) - Standard input (data fed into the program)
STDOUT (1) - Standard output (data printed by the program, defaults to the terminal)
STDERR (2) - Standard error (for error messages, also defaults to the terminal)
Piping and redirection is the means by which we may connect these streams between
programs and files to direct data in interesting and useful ways.
15. teachics.org
Piping
Pipes allow you to funnel the output from one command into another where it will be used as
the input.
Pipes are unidirectional
The | operator feeds the output from the program on the left to the program on the right.
This will sort the given file and print the unique values only.
sort record.txt | uniq
16. teachics.org
Redirection
By default, stdout and stderr are printed to your terminal.
But we can redirect that output to a file using the > operator:
echo hello > new-file
echo didnt print anything to the terminal because we redirected its output to a file named new-file.
it replaces new-files contents with the new contents.
If you want to append to the file, you can use the >> operator
echo hello again >> new-file
17. teachics.org
Informal Commands
ps - to see which processes you're currently running on your Linux system.
Using the -f option for ps you can gain additional useful information on each process in the
listing.
w - command-line utility that displays information about currently logged in users and what
each user is doing. It also gives information about how long the system has been running, the
current time, and the system load average.
id - used to find out user and group names and numeric IDs (UID or group ID) of the
current user or any other user in the server.
free - displays the total amount of free space available along with the amount of memory
used and swap memory in the system, and also the buffers used by the kernel.
clear - used to remove all previous commands and output fromterminal windows
18. teachics.org
Informal Commands
echo - display a line of text/string on standard output or a file.
echo [option(s)] [string(s)]
eg:-
echo Hello World
echo The value of variable x = $x
echo -e "Hello nWorld"
more - used to view the text files in the command prompt, displaying one screen at a time in case the file is large. The
more command also allows the user do scroll up and down through the page.
more [-options] [-num] [+/pattern] [+linenum] [file_name]
[-options]: any option that you want to use in order to change the way the file is displayed. (-d, -l, -f, -p, -c, -s, -u)
[-num]: type the number of lines that you want to display per screen.
[+/pattern]: replace the pattern with any string that you want to find in the text file.
[+linenum]: use the line number from where you want to start displaying the text content.
[file_name]: name of the file containing the text that you want to display on the screen.
19. teachics.org
File Permissions
Ownership of Linux files
Every file and directory on your Unix/Linux system is assigned 3 types of owner,
User : owner of the file. By default, the person who created a file becomes its owner.
Group : group can contain multiple users. All users belonging to a group will have the same access
permissions to the file.
Other : This person has neither created the file, nor he belongs to a usergroup who could own the
file. Practically, it means everybody else.
Permissions
Every file and directory in your UNIX/Linux system has following 3 permissions.
Read : authority to open and read a file.
Write: authority to modify the contents of a file.
Execute : In Unix/Linux, you cannot run a program unless the execute permission is set.
20. teachics.org
File Permissions
using chmod command, we can set permissions (read, write, execute) on a file/directory for
the owner, group and the world.
chmod permission file
There are 2 ways to use the command
Absolute mode
Symbolic mode
21. teachics.org
File Permissions
Absolute Mode
file permissions are not represented as characters but a three-digit octal number.
chmod 764 filename
764' absolute code says the following:
- Owner can read, write and execute
- Usergroup can read and write
- World can only read
This is shown as
chmod -rwxrw-r- filename
Number Permission Type Symbol
0 No permission ---
1 Execute --x
2 Write -w-
3 Write + Execute -wx
4 Read r--
5 Read+Execute r-x
6 Read+Write rw-
7 Read+Write+Execute rwx
22. teachics.org
File Permissions
Symbolic Mode
n the symbolic mode, you can modify permissions of a specific owner.
It makes use of mathematical symbols to modify the file permissions..
chmod o=rwx filename
setting others read+write+execute permissions
chmod g+x filename
adding execute permission to group
chmod u-r filename
removing read permission of user
User Description
u user
g group
o other
Operator Description
+ No permission
- Execute
= Write
23. teachics.org
Comments
Lines beginning with a # (with the exception of #!) are comments and will not be
executed.
# This line is a comment
Comments may also occur following the end of a command.
echo a comment will follow # this is a comment
Comments may also follow whitespace at the beginning of a line.
# This is also a comment
a quoted or an escaped # in an echo statement does not begin a comment.
echo hello #This is not a comment
24. teachics.org
Variables
A variable is a name assigned to a location or set of locations in computer memory
holding an item of data.
If variable1 is the name of a variable, then $variable1 is a reference to its value.
The only times a variable appears without the $ prefix is when declared or assigned.
variable1=23
echo $variable1
Essentially, Bash variables are character strings, but, depending on context, Bash
permits arithmetic operations and comparisons on variables. The determining factor
is whether the value of a variable contains only digits.
25. teachics.org
Operators
Assignment Operator
= is the all-purpose assignment operator, which works for both arithmetic and string
assignments.
var=27
category=minerals # No spaces allowed after the "="
Logical Operators
! NOT
&& AND
|| OR
26. teachics.org
Operators
Arithmetic Operators
+ plus
- minus
* multiplication
/ division
** exponentiation
% mod (returns the remainder of an integer division operation)
+= plus-equal (increment variable by a constant) [38]
-= minus-equal (decrement variable by a constant)
*= times-equal (multiply variable by a constant)
/= slash-equal (divide variable by a constant)
%= mod-equal (remainder of dividing variable by a constant)
27. teachics.org
Operators
Relational Operators
-eq equal to
-nt not equal to
-gt greater than
-lt lessthan
-ge greater than or equal to
-le less than or equal to
< is less than (within double parentheses) (("$a" < "$b"))
<= is less than or equal to (within double parentheses) (("$a" <= "$b"))
> is greater than (within double parentheses) (("$a" > "$b"))
>= is greater than or equal to (within double parentheses) (("$a" >= "$b"))
28. teachics.org
Quoting
When referencing a variable, it is generally advisable to enclose its name in
double quotes. This prevents reinterpretation of all special characters within
the quoted string except $, ` (backquote), and (escape).
Use double quotes to prevent word splitting.An argument enclosed in double
quotes presents itself as a single word, even if it contains whitespace
separators.
Within single quotes, every special character except ' gets interpreted.
Consider single quotes ("full quoting") to be a stricter method of quoting than
double quotes ("partial quoting").
The escape () preceding a character tells the shell to interpret that character
literally.
29. teachics.org
read
Reads the value of a variable from stdin, that is, interactively fetches input from the
keyboard.
echo "Enter the value of variable 'var1': "
read var1
echo
prints (to stdout) an expression or variable
echo Hello
echo $a
An echo requires the -e option to print escaped characters.
Normally, each echo command prints a terminal newline, but the -n option suppresses
this.
30. teachics.org
Conditional Commands
if can test any command.Reads the value of a variable from stdin, that is, interactively fetches input from the keyboard.
if [ condition ]
then
command1
else
command2
fi
elif is a contraction for else if. The effect is to nest an inner if/then construct within an outer one.
if [ condition1 ]
then
command1
elif [ condition2 ]
then
command4
else
default-command
fi
31. teachics.org
Conditional Commands
The case construct is the shell scripting analog to switch in C/C++. It permits
branching to one of a number of code blocks, depending on condition tests.
case "$variable" in
"$condition1" )
command...
;;
"$condition2" )
command...
;;
32. teachics.org
iterative commands
A loop is a block of code that iterates [52] a list of commands as long as the loop
control condition is true.
for arg in [list]
do
command(s)...
done
This construct tests for a condition at the top of a loop, and keeps looping as long as
that condition is true (returns a 0 exit status)..
while [ condition ]
do
command(s)...
done
33. teachics.org
break and continue
break command terminates the loop (breaks out of it)
for innerloop in 1 2 3 4 5
do
if [ "$innerloop" -eq 3 ]
then
break # Try break 2 to see what happens.
fi
done
continue causes a jump to the next iteration of the loop, skipping all the remaining
commands in that particular loop cycle.
for inner in 1 2 3 4 5 6 7 8 9 10 # inner loop
do
if [[ "$inner" -eq 7 && "$outer" = "III" ]]
then
continue 2 # Continue at loop on 2nd level, that is "outer loop".
fi
done
35. teachics.org
bc
Bash can't handle floating point calculations, and it lacks operators for certain
important mathematical functions.
echo "scale=2; 2/3" | bc
.66
36. teachics.org
grep
searches a file for a particular pattern of characters and displays all lines that contain
that pattern.
case insensitive search
grep -i Word file.txt
display count of matches
grep -c Word file.txt
checking whole word only
grep -w Word file.txt