Experimet 1 (IOT)
Experimet 1 (IOT)
Experimet 1 (IOT)
Aim: Start Raspberry Pi and try various Linux commands in command terminal window:
ls, cd, touch, mv, rm, man, mkdir, rmdir, tar, gzip, cat, more, less, ps, sudo,cron, chown, chgrp,
ping, chmod, curl, echo, exit, find, finger, free, grep, kill etc.
Use command line terminal of linux operating system, preferably Raspberry Pi operating
system.
Linux Commands:
2. cd: cd command in linux known as change directory command. It is used to change current
working directory.
Syntax:
$ cd [directory]
touch file_name
11
Touch command to create multiple files:
4. mv: mv stands for move. mv is used to move one or more files or directories from one place
to another in file system.
It has two distinct functions:
- It rename a file or folder.
- It moves group of files to different directory.
Syntax:
mv [Option] source destination
5. rm: rm stands for remove here. rm command is used to remove objects such as files,
directories, symbolic links and so on from the file system
Syntax:
rm [OPTION]... FILE...
6. man: man command in Linux is used to display the user manual of any command
Syntax :
$man [OPTION]... [COMMAND NAME]...
Syntax :
$man [OPTION]... [COMMAND NAME]...
9. tar: The Linux ‘tar’ stands for tape archive, is used to create Archive and extract the
Archive files.
Syntax:
tar [options] [archive-file] [file or directory to be archived]
12
Example:
$ gzip mydoc.txt]
11. cat: It reads data from the file and gives their content as output. It helps us to create,
view, concatenate files.
Command:
$cat filename
12. more: more command is used to view the text files in the command prompt, displaying
one screen at a time in case the file is large (For example log files). The more command also
allows the user do scroll up and down through the page.
Syntax:
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.
Choose any one from the followings: (-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.
13. Less: less command is linux utility which can be used to read contents of text file one page
(one screen) per time. It has faster access because if file is large, it don’t access complete file, but
access it page by page.
syntax :
less filename
14. ps: ps for viewing information related with the processes on a system which stands
as abbreviation for “Process Status”
Syntax –
ps [options]
15. sudo: sudo (Super User DO) command in Linux is generally used as a prefix of some
command that only superuser are allowed to run.
16. cron: automates the scheduled task at a predetermined time. It is a daemon process, which
runs as a background process.
Syntax:
cron [-f] [-l] [-L loglevel]
13
17. chown: chown command is used to change the file Owner or group. Whenever you want to
change ownership you can use chown command.
Syntax:
chown [OPTION]… [OWNER][: [GROUP]] FILE…
chown [OPTION]… –reference=RFILE FILE…
18. chgrp: chgrp command in Linux is used to change the group ownership of a file or
directory.
Syntax:
Chgrp [OPTION]… GROUP FILE…
chgrp [OPTION]… –reference=RFILE FILE…
19. ping: PING (Packet Internet Groper) command is used to check the network connectivity
between host and server/host.
20. chmod: the chmod command is used to change the access mode of a file.
The name is an abbreviation of change mode.
Syntax :
chmod [reference][operator][mode] file...
21. curl: curl is a command line tool to transfer data to or from a server, using any of the
supported protocols
Syntax:
curl [options] [URL...]
22. echo: echo command in linux is used to display line of text/string that are passed as an
argument .
Syntax :
echo [option] [string]
23. exit: exit command in linux is used to exit the shell where it is currently running. It takes
one more parameter as [N] and exits the shell with a return of status N.
Syntax:
exit [n]
14
24. find: It can be used to find files and directories and perform subsequent operations on
them. It supports searching by file, folder, name, creation date, modification date, owner and
permissions.
Syntax :
$ find [where to start searching from]
[expression determines what to find] [-options] [what to find]
25. Finger: command is a user information lookup command which gives details of all the
users logged in
Syntax:
$finger[username]
26. Free: command which 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.
.
Syntax:
$free [OPTION]
27. Grep: The grep filter searches a file for a particular pattern of characters, and displays all
lines that contain that pattern.
Syntax:
grep [options] pattern [files]
28. Kill: command in Linux (located in /bin/kill), is a built-in command which is used to
terminate processes manually. kill command sends a signal to a process which terminates the
process.
15