0% found this document useful (0 votes)
47 views

Embedded Programming: Linux Commands

The document provides an overview of common Linux commands organized into categories including file handling, text processing, system administration, and process management. Key commands covered include mkdir to create directories, ls to list directory contents, cd to change directories, pwd to print the current working directory, vim for text editing, cp to copy files, mv to move files, rm to remove files, find to search for files, cat to concatenate files, echo to display text, grep to search for patterns in files, wc to count lines/words/bytes, sort to sort lines, chmod to change file permissions, chown to change file ownership, su to change user ID, passwd to manage passwords, who to see logged in users, ps to

Uploaded by

Benhar Rz
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Embedded Programming: Linux Commands

The document provides an overview of common Linux commands organized into categories including file handling, text processing, system administration, and process management. Key commands covered include mkdir to create directories, ls to list directory contents, cd to change directories, pwd to print the current working directory, vim for text editing, cp to copy files, mv to move files, rm to remove files, find to search for files, cat to concatenate files, echo to display text, grep to search for patterns in files, wc to count lines/words/bytes, sort to sort lines, chmod to change file permissions, chown to change file ownership, su to change user ID, passwd to manage passwords, who to see logged in users, ps to

Uploaded by

Benhar Rz
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

EMBEDDED

PROGRAMMING
Linux Commands

BENHAR SILVAN
17MES0033

17MES0033 Benhar Silvan


File Handling commands
 mkdir –
o make directories
o Usage: mkdir [OPTION] DIRECTORY...

o eg. mkdir 17MES0033


 ls –
o list directory contents

o Usage: ls [OPTION]... [FILE]...

o eg. ls, ls -l, ls experiment


 cd –
o changes directories

o Usage: cd [DIRECTORY]

o eg. cd 17MES0033

Usage: pwd

 pwd - print name of current working directory

17MES0033 Benhar Silvan


Lab Assignment

 Vim –
Vi Improved, a programmers text editor

Usage: vim [OPTION] [file]...

eg. vim file1.txt


 cp – copy files and directories
o Usage: cp [OPTION]... SOURCE
DEST eg. cp sample.txt
sample_copy.txt
 cp sample_copy.txt target_dir
 mv – move (rename) files

o Usage: mv [OPTION]...
SOURCE DEST eg. mv
source.txt target_dir

 mv old.txt new.txt


 rm - remove files or directories
o Usage: rm [OPTION]...
FILE... eg. rm file1.txt , rm
-rf some_dir
 find – search for files in a directory
hierarchy Usage: find [OPTION] [path]
[pattern]

eg. find file1.txt, find -name file1.txt

 history – prints recently used
commands Usage: history
Text Processing

  cat –
concatenate files and print on the standard output

Usage: cat [OPTION] [FILE]...


eg. cat file1.txt file2.txt
cat -n file1.txt
 echo –
display a line of text
Usage: echo [OPTION] [string] ...
echo HII ALL
echo $HOME
 grep - print lines matching a pattern
Usage: grep [OPTION] PATTERN [FILE]...
eg. grep -i apple sample.txt
 wc - print the number of newlines, words, and bytes in
files

Usage: wc [OPTION]... [FILE]...

17MES0033 Benhar Silvan


eg. wc file1.txt

wc -L file1.txt

 sort – sort lines of text files


Usage: sort [OPTION]... [FILE]...
eg. sort file1.txt
sort -r file1.txt
System Administration
• chmod –
change file access permissions
Usage: chmod [OPTION] [MODE] [FILE]

eg. chmod 744 calculate.sh

• chown –
change file owner and group
Usage: chown [OPTION]... OWNER[:[GROUP]] FILE...
eg. chown remo myfile.txt

• su – change user ID or become super-user


Usage: su [OPTION] [LOGIN]
eg. su remo, su

• passwd – update a user’s authentication tokens(s)


Usage: passwd [OPTION]
17MES0033 Benhar Silvan
eg. passwd
• who – show who is logged on
Usage: who [OPTION]
• uname command supports following options to view
the information individually.
-s kernel name
-n node name
-r kernel release
-v kernel build date
-m hardware name
-p processor type
-i hardware platform
-o OS name
-a all above information
Process Management
• ps –
report a snapshot of the current processes

Usage: ps [OPTION]
eg. ps, ps -el

 kill:
to kill a process(using signal mechanism)

17MES0033 Benhar Silvan


Usage: kill [OPTION] pid

eg. kill -9 2275


• bg To send a process to the background

• fg To run a stopped process in the foreground


• top Details on all Active Processes

• ps PID Gives the status of a particular process •

pidof Gives the Process ID (PID) of a process

• nice Starts a process with a given priority

• renice Changes priority of an already running process

• df Gives free hard disk space on your system

• free Gives free RAM on your system

17MES0033 Benhar Silvan

You might also like