Saturday, March 16, 2024

Program 2 B.Sc Computer Science BCA Linux and Shell Programming - Lab Bharathiar University - Write a shell script to show the following system configuration

 

B.Sc Computer Science 

Linux and Shell Programming - Lab  

Bharathiar University 

Program  2. Write a shell script to show the following system configuration :

a. currently logged user and his log name
b. current shell , home directory , Operating System type , current Path setting , current
working directory
c. show currently logged number of users, show all available shells
d. show CPU information like processor type , speed 
e. show memory information


Source Code

echo "Currently logged user and his log name:"
echo " Username: $(whoami)"
echo " Login name: $(logname)"
echo

echo " Current shell: $SHELL"
echo " Home directory: $HOME"
echo " Operating System type: $(uname -s)"
echo " Current Path setting: $PATH"
echo " Current working directory: $(pwd)"
echo

echo " Currently logged users: $(who | wc -l)"
echo " Available shells: $(cat /etc/shells)"
echo

echo " Processor type: $(uname -p)"
echo " Processor speed:"
echo " $(cat /proc/cpuinfo | grep "MHz")"
echo
echo "Memory information:"
echo "$(free -h)"



SAMPLE OUTPUT:




No comments:

Post a Comment

Program 12 BCA Madras University BCA Object Oriented Programming using C++ Practical Madras University Program 12 Implement a telephone directory using files

  BCA Object Oriented Programming using C++ Practical Madras University  Program 12  Implement a telephone directory using files SOURCE CODE...