[go: up one dir, main page]

0% found this document useful (0 votes)
2 views3 pages

Bash Basics

This document provides an overview of basic Bash commands used in Linux and Unix systems, including commands for displaying text, navigating directories, listing files, creating files, copying, moving, deleting files, viewing file content, searching for text, and getting help. Each command is accompanied by a description and examples. For advanced functionalities, it suggests consulting manual pages or additional resources.

Uploaded by

ritaberrada06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Bash Basics

This document provides an overview of basic Bash commands used in Linux and Unix systems, including commands for displaying text, navigating directories, listing files, creating files, copying, moving, deleting files, viewing file content, searching for text, and getting help. Each command is accompanied by a description and examples. For advanced functionalities, it suggests consulting manual pages or additional resources.

Uploaded by

ritaberrada06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Basic Bash Commands

GHOUSSEIN Edouardo
October 23, 2024

1 Introduction
Bash (Bourne Again SHell) is a command language interpreter that is widely
used in many Linux and Unix systems. This document provides a list of basic
Bash commands along with examples.

2 Basic Commands
2.1 1. Displaying Text
Command: echo
Description: Displays a line of text.
1 $ echo " Hello , World ! "
2 Hello , World !

Listing 1: Example of echo command

2.2 2. Navigating Directories


Command: cd
Description: Changes the current directory.
1 $ cd / path / to / directory
2 $ pwd # Prints current d i r e c t o r y
3 / path / to / directory

Listing 2: Example of cd command

2.3 3. Listing Files


Command: ls
Description: Lists files and directories.
1 $ ls
2 file1 . txt file2 . txt directory1 /

Listing 3: Example of ls command

1
2.4 4. Creating Files
Command: touch
Description: Creates an empty file or updates the timestamp of an existing
file.
1 $ touch newfile . txt
2 $ ls
3 newfile . txt file1 . txt file2 . txt directory1 /

Listing 4: Example of touch command

2.5 5. Copying Files


Command: cp
Description: Copies files or directories.
1 $ cp file1 . txt file1_backup . txt
2 $ ls
3 file1 . txt file1_backup . txt file2 . txt directory1 /

Listing 5: Example of cp command

2.6 6. Moving Files


Command: mv
Description: Moves or renames files or directories.
1 $ mv file1 . txt new_directory /
2 $ ls
3 file2 . txt directory1 /

Listing 6: Example of mv command

2.7 7. Deleting Files


Command: rm
Description: Removes files or directories.
1 $ rm file1_backup . txt
2 $ ls
3 file2 . txt directory1 /

Listing 7: Example of rm command

2
2.8 8. Viewing File Content
Command: cat
Description: Concatenates and displays file content.
1 $ cat file2 . txt
2 This is the content of file2 .

Listing 8: Example of cat command

2.9 9. Searching for Text in Files


Command: grep
Description: Searches for a specified pattern in files.
1 $ grep " pattern " file2 . txt
2 This line contains the pattern .

Listing 9: Example of grep command

2.10 10. Getting Help


Command: man
Description: Displays the manual for a command.
1 $ man ls

Listing 10: Example of man command

3 Conclusion
This document provides a basic overview of Bash commands and their us-
age. For more advanced functionalities, consult the manual pages or further
resources.

You might also like