[go: up one dir, main page]

0% found this document useful (0 votes)
28 views16 pages

LS Notes

Uploaded by

Shambhavi K
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)
28 views16 pages

LS Notes

Uploaded by

Shambhavi K
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/ 16

Course Overview

1.Linux System
2.Adv C
3.C++
4.Data Structure
5.Microcontroller
6.Linux Internal
7.ELARM

Linux System

1.Overview of Linux
2.User Interface
3.Shell and Basic Commands
4.Vim Editor
5.Shell Scripting

P1 - 1hr 2ms
-1.5 hrs 2ms round robin algorithm'
P2
P3 -30 min 2ms
P4 -15 min 2ms

1.scheduling
2.memory management
3.device management
4.Inter process communication
5.I/O process
6.network management
7.file management

mobile and laptop - generic purpose embedded system


www.kernal.org

application
distribution

distros
customize

kernal

c
user space

kernel space

device drivers - interface between device and operating system

system call interface - interface user space and kernal


User Interface gui name in ubuntu - GNOME

1.GUI - graphical user interface KDM - KDE display manager


2.CLI - command line interface
kde - kool desktop environment

Shell types

1. based on the way it is opened


2. based on the behaviour

to launch the shell to close the shell

1.GUI
1.GUI
2.ctrl+d
2.ctrl+alt+t
3.exit
3.alt+f2(gnome-terminal)

based on the way of opening the shell


1.login shell
2.non login shell (WSL)

to launch the login shell to close login shell

ctrl+alt+f3/f4/f5/f6 ctrl+alt+f2

based on the behaviour

1.sh - shell
2.bash - bourne again shell
3.csh
4.ksh
command(ls)

error output suggestion

emertxe@ubuntu:~$ - prompt
~ - tilde

home directory
user host
name name path(location)

dark blue - directories


ls - list directory contents green - executables files
man - manual page white/black - regular file
-press q to come out of the man page sky blue - link file

ls -F
/ - directory
* - executable file
ls -a - for listing hidden files
@ - link file
ls -l - for long listing
| - PIPE file
ls -F - to classify based on symbols
ls -h - human readable form
types of commands type - to identify the type of command

1.executable program(non built in)


2.Shell built in - commands installed while installing shell itself
3.aliased(user defined name for existing command)

1.exit - close the terminal cd <dir name>


2.clear(ctrl+l) - clear the screen cd .. - to go parent dir
3.pwd - present working directory
4.ls - listing directory contents
5.man - manual page .. - parent directory
6.type . - present directory
7.cd - change directory - ->previously working directory
8.mkdir - to create directory
9.touch - creating file
10.rmdir - for removing empty directories
11.rm - for removing files and directories

24010

ECEP

LS C C++ DS MC LI

classwork assignment classwork


assignment

project
create files create files create files create files
emertxe@ubuntu:~$

path

path
1.absolute path - with reference to the root directory
2.relative path - with reference present working directory

~ home

emertxe

24010

ECEP
Test
New_Dir
Dir New_Test1
LS

/ - slash directory or root directory

slash root dir


/

bin sbin lib usr

/usr/bin
/usr/sbin
/usr/lib
copy - cp move/renaming - mv
copy+paste cut+paste

syntax syntax
mv <source> <destination>
cp <source> <destination>

User Specific Commands

1.whoami - effective user of the system


2.w - show who logged in and what they are doing
3.who - show who logged in and time of login
4.uname - information about the system
5.which - to locate command binary
6.whereis - to locate command binary, library and manual files
7.date - system date and time
8.cal - calendar
Vi Editor
sudo apt update
sudo apt install vim
vim/vi - visual editor - application

- cli based text editor on GUI


- .txt, .sh, .c, .cpp, .py

vi <filename> or vim <filename>

Modes of vi editor
esc :q - to quit
1.esc mode / command esc :w - to save
-default mode whenever we open a file esc :wq - to save and quit
-press esc key to enter the escape mode esc :q! - to quit without saving
2.edit mode
-insert mode
-press i or insert key
-replace mode
-press R or insert key 2 times
3.visual mode
-press v
Vim Shortcuts

1. yy - copy
2.p - paste below the cursor position
3. nyy - to copy n lines
4.np - to paste n times
5.dd - delete
6.ndd - delete n lines
7.dw - delete word
8.ndw - delete n word
9. x - delete character
10. nx -to delete n character
11. u - undo
12.ctrl+r - redo
13.yw - copy word vimtutor - tutorial for vim
14.nyw - copy n words
15.d$ - delete all the characters from the cursor position
16.d^- delete all character before cursor position
17.o - insert new line below cursor position and enter insert mode
18.O - insert new line above cursor position and enter insert mode
19. gg - to go to first line
20. ngg - to go to nth line
21.G/shift+g - to go to the last line

esc :set nu - enable line no


esc :set nonu - disable line no
esc :set hls - enable highlight
sec :set nohls - disable highlight

to find and replace

esc :%s/oldword/newword
esc :%s/oldword/newword/g - to change in entire document

esc :e <newfilename> - to open a new file without exiting the current file

ctrl+6 to shift between the 2 files

vi <multiple file names>

:n - to go to the next file


:N - to go to previous file

:r - to read
File Specific Commands

1. cat
cat <file name>
ctrl+d to exit
2.wc
3.head
4.tail
5.more
6.less
q - to exit
:n - to go to next file
:p - to go to previous file

Redirection

-saving the output of a command to a file

stderr - 2
stdin - 0
stdout - 1

cmd stdout > - output redirection


terminal
< - input redirection/indirection
>> - appending
&> - redirect both output and error

out.txt

file descriptors or file id


Piping |

cmd1 | cmd2 | cmd3 | cmd4

-giving the output of one command as input to next command


Shell Variables

Variables hold some values that can be changed

-shell variable is untype


-no datatype

echo - to print
read - to read value from user

Expression Evaluation Methods

1.expr
2.$(())
3.let
4.bc

expr
- evaluate only integer values
-\*,\>,\<
-space is mandatory between arguments

$(())

-space not mandatory


-no backslash required
-only for integer value

sudo apt update


3.let
sudo apt install bc
-space should not be given
-only for integers
command substitution method

1.backtick`````
2.$()

1.Find the perimeter of rectangle


2.Try all the arithmetic operation in all the expression evaluation method
Shell Scripting

She-bang line - #!/bin/bash

execution of script

1. bash <filename>
2. path(./)

WAS to find the addition of 2 numbers

WAS to check whether the given number is greater than 5

num > 5

if

syntax num -gt 5

if [ condition ] > -gt


{ then < -lt
stmts >= -ge
} fi <= -le
== -eq
!= -ne
WAS to check whether the given number is greater than 5 or not

num > 5 or num < 5

if..else
if [ condition ]
then
stmt1
else
stmt2
fi

num>5
if .. elif
num<5
num=5
condition
if [ condition ]
then f
t
stmt1
elif [ condition1 ] condition1
stmt1
then t f
stmt2
elif [ conditon2 ] stmt2 condition2
then
stmt3 f
t
else
stmt4 else
fi stmt3

stmt4
WAS to check whether the given number is between 5 and 10

num
num > 5
num < 10

1.logical operators
2.nested if

logical operators
and

and -a cond1 cond2 and


or -o 0 0 0
not ! 1 0 0
0 1 0
1 1 1

or not
cond1 cond2 or
0 0 0 condition not
1 0 1 0 1
0 1 1 1 0
1 1 1

[ num -gt 5 -a num -lt 10 ]

homeworks

1.WAS to find the perimeter of rectangle


2.WAS to find the area of triangle
3.WAS to find the largest of 2 numbers
4.WAS to find the largest of 3 numbers

You might also like