TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
12 views
20 slides
Mar 06, 2025
Slide 1 of 20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
About This Presentation
All basic terminal commands included
Size: 207.63 KB
Language: en
Added: Mar 06, 2025
Slides: 20 pages
Slide Content
TERMINAL COMMAND EXPERIMENT 3 Terminal commands are instructions you type into a command-line interface (CLI) to interact with your computer’s operating system. These commands allow you to perform tasks like managing files, controlling processes, and configuring the system directly through the terminal.
pwd pwd command in Linux displays the absolute path of the current working directory. history Used to show the history of commands that are previously being used.
The man command is used to display the manual pages (documentation) for various commands. It stands for "manual," and it provides detailed information and usage instructions for the specified command. MAN
The cd command is used to change the current working directory (which is why it’s called cd) and navigate across the file directory of the host machine. cd 1. Go to the home directory: This takes you to your home directory (e.g., /home/username).
Cd .. This command is used to move to parent directory of current directory,or the directory one level up from the current directory. 2. Navigate to the parent directory (one level up):
The ls command is used to list files and directories under a specific path, or the current working directory whenever a path is not provided. 2. The ls Command The -l option can be used to show the size, last modified date-time as well as directory/file ownership and permissions.
1. List files in a specific directory: Displays the contents of /home/user. 2.Show hidden files and directories: Lists all files, including hidden ones (those starting with a dot .).
3. Detailed listing (long format): Shows permissions, ownership, size, and modification date of each file. 4. Combine long listing with hidden files: Displays a detailed list including hidden files.
5. Sort by modification time (most recent first): Lists files with the newest files shown first. 6. Sort by file size (largest first): Lists files ordered by size, largest first.
7. List directories only: Shows only directories , not regular files.
The pwd command stands for print working directory, and as the name suggests, it is used to print out the absolute path to the current directory. 3. The pwd Command
the mkdir command can be used to create new directories on the file system. 4. The mkdir Command 1. Create multiple directories at once: Creates three directories: folder1, folder2, and folder3.
2. Create directories using a range of names: Creates folder1, folder2, folder3, folder4, and folder5.
In contrast to mkdir , the rmdir is used to remove empty directories from the file system: 5. The rmdir Command If the projects directory is non-empty, however, the above command will fail, with the following error:
6. The rm Command To remove non-empty directories along with their sub-directories and files, you’ll have to run the rm command with -r and -f flags: 7. The mv Command The mv command is used to move directories or files from one place in the file system to another. The following command will move the file picture.png that currently resides in ~/Downloads directory into the ~/Documents/Photography/ directory:
Touch command is used to create a blank new file in the directory Touch The touch command can create multiple files as well
cat The cat command in Linux is used to concatenate (join) and display the content of files. It is one of the most frequently used commands for viewing, combining, and creating files. The cat command in Linux is called a versatile command because it can perform multiple tasks Common Uses of cat Command: 1. Display the content of a file: Shows the content of filename.txt on the terminal.
2. View multiple files together: Displays the content of both file1.txt and file2.txt sequentially. 3.Create a new file: Allows you to type content directly into a new file (Press CTRL+D to save and exit).
4.Append content to an existing file: Adds new content to the end of existingfile.txt (Press CTRL+D to save and exit). 5.Number lines in a file: Displays the file with line numbers.