GTU OS Program - 9

9. Write a shell script to display all executable files, directories and zero sized files from current directory.

First of all let's understand the meaning of terms like exectable files, directories and zero sized files

Executable Files means the files that can be exeuted. It is used to perform various functions or operations on a computer. Unlike a data file, an executable file cannot be read because it's compiled. For example executable files in a microsoft windows os is .exe file on maacOS its .dmg and .app.

directories means folders

Zero sized files are those having its size equal to 0.

for displaying executable files we will use find <dirname> -executable -type f command

creating a new file display_info.sh using vim

 tkanu025@hp:~$ vim display_info.sh 

Complete code of the program

echo "Executable files"
files="$(find lab_solutions -executable -type f)"
echo "$files"
echo
echo "List of Directories"
dir="$(ls -d */)"
echo "$dir"
echo
echo "List of zero sized files"
zero="$(find -size 0)"
echo "$zero"

Interpreting the display_info.sh file and executing it in terminal

tkanu025@hp:~$ chmod +x display_info.sh
tkanu025@hp:~$ ./display_info.sh
Output
gtu study material for free cse gtu best gtu study material for engineering student

gtu os lab manual,

os GTU Practical,

operating system Programs,

Operating system shellscript programs,

Gtu study material 3140705,

OS 3140702,

os practical list,

shell script programming,

gtu os practical,

os lab solution gtu

Comments

YouTube

Popular posts from this blog

GTU OOP Program - 18

GTU OS Program - 7

GTU OS Program - 3