Exp 1
Exp 1
Experiment No.1
Explore the internal and external commands of Linux.
Date of Performance:
Date of Submission:
Vidyavardhini’s College of Engineering & Technology
Department of Computer Engineering
• Internal Commands : Commands which are built into the shell. For all the shell built-in
commands, execution of the same is fast in the sense that the shell doesn’t have to search
the given path for them in the PATH variable, and also no process needs to be spawned
for executing it.
Examples: source, cd, fg, etc.
• External Commands : Commands which aren’t built into the shell. When an external
command has to be executed, the shell looks for its path given in the PATH variable, and
also a new process has to be spawned and the command gets executed. They are usually
located in /bin or /usr/bin. For example, when you execute the “cat” command, which
usually is at /usr/bin, the executable /usr/bin/cat gets executed. Examples: ls, cat etc.
pwd : It gives absolute path to your current location i.e. current working directory.
napster@napster-Veriton-Series:~$ pwd
/home/napster
cat : 1) It can also use to create new file with content as shown below.
cat> hello.txt
hello from Shamika
2) It can also use to append the data into existing file as shown below.
cat>>hello.txt
How are you?
3) It is used to concatenate files.
napster@napster-Veriton-Series:~/TRIAL$ cat
hello.txt hi.txt hello from Shamika How are you?
Welcome to Os Lab.
mv: To rename a file from source to destination and To move file from one location to
other location.
grep: It searches all text files in the current directory for lines containing “hello”
napster@napster-Veriton-Series:~/TRIAL$ grep hello *.txt hello from
Shamika
date: Print or set the system date and time ,Display the current time in the given
FORMAT, or set the system date.
b1@comp:~$ date
Fri Feb 16 15:43:44 IST 2018
time: Displays time of the system.
2) User Commands
Conclusion:
In this experiment, we explored the internal and external commands of the Linux operating
system. Internal commands, being built into the shell, execute faster as they do not require
searching through directories. Examples include cd, pwd, and echo. External commands, on
the other hand, require execution from directories like /bin or /usr/bin, leading to the creation
of a new process. Examples include ls, cat, and grep. Understanding these commands is
essential for efficient navigation, file management, and system administration in Linux. This
knowledge serves as a foundation for mastering more advanced Linux operations.