OS
What is an Operating System?
An operating system, or "OS," is software that communicates with the
hardware and allows other programs to run. It is comprised of system
software, or the fundamental files your computer needs to boot up and
function. Every desktop computer, tablet, and smartphone includes an
operating system that provides basic functionality for the device.
Common desktop operating systems include Windows, OS X, and Linux.
While each OS is different, most provide a graphical user interface, or GUI,
that includes a desktop and the ability to manage files and folders. They also
allow you to install and run programs written for the operating system.
Windows and Linux can be installed on standard PC hardware, while OS X is
designed to run on Apple systems. Therefore, the hardware you choose
affects what operating system(s) you can run.
How do Operating Systems impact software development?
Being a developer you might have focused your skills on problem-solving and
data structures. However, consider a scenario where you’re executing code,
but your program runs too slowly. You check your code, and you find that
there is nothing wrong with your code. What could be the reason behind this?
Well, one of the reasons could be your operating system. If you need to
debug your program then how would you do that if you don’t know how your
operating system works? Some possibilities are that you’re accessing too
many files, you’re running out of memory or that swap is in high usage.
Other considerations include:
Is it a local program or is the code running over the Internet?
Why do some programmers prefer one OS over another?
As a developer, you should understand the importance of the operating
systems. Today we are going to discuss some important concepts about
operating systems that will help in your professional development.
Process and Process Management
The process is basically defined as a program in execution. The process
should be executed sequentially. When you write a computer program in a
text file and when you execute this program it becomes a process in your
system. This process performs all the tasks mentioned in the program. A
process generally passes through (but doesn't always) five different states:
Start, Ready, Running, Waiting, Terminated, or Exit. These states may have
different names depending on the operating system.
Threads
You can define a thread as a flow of execution through the process code. The
thread keeps track of all the instructions that need to be executed next in the
program counter. Also, the thread contains system registers that hold the
current working variables. Also, the thread's stack contains the execution
history.
Scheduling
In scheduling, the process manager takes the responsibility to remove the
running process from the CPU and chooses another process based on a
specific strategy. For multiprocessing operating systems scheduling is the
essential part. More than one process can be loaded into the executable
memory at a time. The processes share the CPU using time multiplexing
once they are loaded.
Memory Management
Memory management refers to the functionality of an operating system that
handles and manages the primary memory. Processes move back and forth
between the main memory and the disk during the execution.
Unix/Linux: Demo Moving and Deleting Files (Using Git Bash)
Linux is a free and open-source software that operates on its own operating
system. The term ‘Linux’ stands for GNU + Linux. Initially developed by
Linus Torvalds, it was created alongside the source code of Unix.
Linux commands are a type of Unix command or shell procedure. They are
the basic tools used to interact with Linux on an individual level. Linux
commands are used to perform a variety of tasks, including displaying
information about files and directories.
Commands
1. Is command in Linux
The ls command is commonly used to identify the files and directories in the
working directory.
2. pwd command in Linux
The pwd command is mostly used to print the current working directory on
your terminal.
3. mkdir command in Linux
This mkdir command allows you to create fresh directories in the terminal
itself. The default syntax is mkdir <directory name> and the new directory
will be created.
Mkdir linux
4. cd command in Linux
The cd command is used to navigate between directories. It requires either
the full path or the directory name, depending on your current working
directory.
5. rmdir command in Linux
The rmdir command is used to delete permanently an empty directory.
Rmdir linux
6. cp command in Linux
The cp command of Linux is equivalent to copy-paste and cut-paste in
Windows.
Cp file1.txt file2.txt
7. mv command in Linux
The mv command is generally used for renaming the files in Linux.
Mv file1.txt rename.txt
8. rm command in Linux
rm command in Linux is generally used to delete the files created in the
directory.
Rm file2.txt
9. uname command in Linux
The uname command is used to check the complete OS information of the
system.
10. locate command in Linux
The locate command is generally used to locate the files in the database.
Use an asterisk (*) to search for content that contains two or more words. As
an example: locate first*file. This command will search the database for
the files that contain these two names first and file.
Locate rename
11. touch command in Linux
The touch command creates an empty file when put in the terminal in this
format as touch <file name>
Touch file.txt
12. ln command in Linux
The ln command is used to create a shortcut link to another file.
Mkdir Demo
Mkdir Linked
Ln -S Demo Linked
13. cat command in Linux
The cat command is the simplest command to use when you want to see
the contents of a particular file.
Cat rename.txt
14. clear command in Linux
The clear command is a standard command to clear the terminal screen.
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ ls
'#11529788.xls'
'#30875EAF.pptx'
'#5FFC725E.jpg'
'#99745836.doc'
'$0049E269.pptx'
'$3F10BB8A.jpg'
'$43FA8C3C.doc'
'$F77FDBC5.xls'
'3D Objects'/
AppData/
'Application Data'@
Contacts/
Cookies@
Documents/
Downloads/
Favorites/
IntelGraphicsProfiles/
Links/
'Local Settings'@
Music/
'My Documents'@
NTUSER.DAT
NTUSER.DAT{49a2fef9-b067-11ef-8227-84a93855a2a7}.TM.blf
NTUSER.DAT{49a2fef9-b067-11ef-8227-
84a93855a2a7}.TMContainer00000000000000000001.regtrans-ms
NTUSER.DAT{49a2fef9-b067-11ef-8227-
84a93855a2a7}.TMContainer00000000000000000002.regtrans-ms
NetHood@
OneDrive/
'OneDrive - revature.com'/
Postman/
PrintHood@
Recent@
'Saved Games'/
Searches/
SendTo@
'Start Menu'@
Templates@
Untitled.ipynb
Untitled1.ipynb
Untitled2.ipynb
Untitled3.ipynb
Videos/
anaconda3/
angular-course/
angular-firstapp/
eclipse/
eclipse-workspace/
linuxCommands/
ml-docker-app/
mlartifacts/
mlruns/
my-app/
ntuser.dat.LOG1
ntuser.dat.LOG2
ntuser.ini
test/
test.mv.db
test.trace.db
zipkin-server-2.12.9-exec.jar*
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ pwd
/c/Users/RemyaGopalakrishnan
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64 ~
$ cd linuxCommands
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ mkdir linux
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
linux/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ mkdir command
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/ linux/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ rmdir linux
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ ls
command/
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ cp file1.txt file2.txt
cp: cannot stat 'file1.txt': No such file or directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands
$ cd command
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cp file1.txt file2.txt
cp: cannot stat 'file1.txt': No such file or directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ls
file1.txt.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cp file1.txt file2.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mv file1.txt rename.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ rm file2.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ uname
MINGW64_NT-10.0-22631
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ locate rename
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ locate rename.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd..
bash: cd..: command not found
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd linuxCommands
bash: cd: linuxCommands: No such file or directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ..cd
bash: ..cd: command not found
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cd/
bash: cd/: No such file or directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ touch file.txt
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mkdir Demo
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ mkdir Linked
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -S Demo Linked
ln: Linked: hard link not allowed for directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -s Demo Linked
ln: failed to create symbolic link 'Linked/Demo': No such file or directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ ln -S Demo Linked
ln: Linked: hard link not allowed for directory
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ cat rename.txt
hello
AzureAD+RemyaGopalakrishnan@Rev-PG02Q4F4 MINGW64
~/linuxCommands/command
$ clear
15. ps command in Linux
ps command in Linux is used to check the active processes in the terminal.
16. man command in Linux
The man command displays a user manual for any commands or utilities
available in the Terminal, including their name, description, and options.
Man ls
17. grep command in Linux
The grep command is used to find a specific string in a series of outputs.
cat rename.txt
cat rename.txt | grep “hello”
18. echo command in Linux
echo command in Linux is specially used to print something in the terminal
echo “hello world”
19. wget command in Linux
The wget command in the Linux command line allows you to download files
from the internet. It runs in the background and does not interfere with other
processes.
Wget http://www.google.com/sample.php
20. whoami command in Linux
The whoami command provides basic information that is extremely useful
when working on multiple systems.
Whoami
21. sort command in Linux
The sort command is used generally to sort the output of the file.
Cat rename.txt
Sort rename.txt
22. cal command in Linux
The cal command is not the most famous command in the terminal but it
functions to view the calendar for a particular month in the terminal.
Cal April 2025
23. df command in Linux
df command in Linux gets the details of the file system.
Df -h
we have used df -h as simply typing df will return the output in bytes which
is not readable, so we add -h to make the outputs more readable and
understandable.
25. wc command in Linux
wc command in Linux indicates the number of words, characters, lines, etc
using a set of options.
wc -w shows the number of words
wc -l shows the number of lines
wc -m shows the number of characters present in a file
touch newfile.txt
echo -e “This file has only six words”>newfile.txt
wc -w newfile.txt