Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Bash Important Commands

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Bash Important Commands

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Coding Savvy

Be A Savvy Coder

Top 15 Bash Commands for Web Development:

Bash (Bourne Again Shell) is a command-line interpreter and scripting language for Unix-like
systems, created by Brian Fox in 1989. Its name is a playful reference to the original Bourne Shell
(sh) by Stephen Bourne. Bash CLI is widely used for automation, system administration, and
software development due to its ubiquity and powerful scripting capabilities .

1) Root Directories
 Definition: Root directories are the top-level directories in a file system hierarchy. In
Unix-like operating systems, such as Linux, macOS, and Unix itself, the root directory
is denoted by a forward slash /.
 Example: /, /home, /var, /usr, etc.
2) ls Command
 Definition: The ls command is used to list files and directories in the current
directory.
 Example:
 ls: Lists files and directories in the current directory.
 ls -a: Lists all files, including hidden ones.
3) cd Command
 Definition: The cd command is used to change directories.
 Example:
 cd path/to/directory: Changes to the specified directory.
 cd ~: Changes to the user's home directory.
 cd ..: Moves up one directory level.
 cd /: Changes to the root directory.
4) pwd Command
 Definition: The pwd command stands for "print working directory" and is used to
display the current working directory.
 Example:
 pwd: Displays the current working directory.
5) touch Command
 Definition: The touch command is used to create empty files or update the access
and modification timestamps of existing files.
 Example:
 touch filename.txt: Creates a new empty file named filename.txt.
6) mkdir Command
 Definition: The mkdir command is used to create new directories.
 Example:
 mkdir directory_name: Creates a new directory named directory_name.
7) mv Command
 Definition: The mv command is used to move or rename files and directories.
 Example:
 mv file1.txt directory: Moves file1.txt to the directory.
 mv file1.txt file2.txt: Renames file1.txt to file2.txt.
Coding Savvy
Be A Savvy Coder

8) rm Command
 Definition: The rm command is used to remove files or directories.
 Example:
 rm file.txt: Deletes the file named file.txt.
 rm -r directory: Deletes the directory and its contents recursively.
9) rmdir Command
 Definition: The rmdir command is used to remove empty directories.
 Example:
 rmdir directory: Deletes the empty directory named directory.
10) Start / Code
 Definition: The start and code commands are specific to Windows and Visual Studio
Code (VS Code) respectively. start is used to open a file or URL using the default
application associated with it. code is used to open VS Code from the command line.
 Example:
 start filename.txt: Opens filename.txt with the default application.
 code .: Opens VS Code in the current directory.
11) grep Command
 Definition: The grep command is used to search for patterns in files.
 Example:
 grep pattern filename.txt: Searches for pattern in filename.txt.
12) Git Commands
 Definition: Git commands are used to manage source code versions and collaborate
with others.
 Example:
 git add .: Adds all changes in the current directory to the staging area.
 git commit -m "Commit message": Commits staged changes with a message.
13) head and tail Commands
 Definition: The head and tail commands are used to display the beginning and end of
files respectively.
 Example:
 head filename.txt: Displays the first few lines of filename.txt.
 tail filename.txt: Displays the last few lines of filename.txt.
14) Nano and Vim Commands
 Definition: Nano and Vim are text editors commonly used in the command line.
 Example:
 nano filename.txt: Opens filename.txt in the Nano editor.
 vim filename.txt: Opens filename.txt in the Vim editor.
15) Echo and Shell Redirection
 Definition: echo command is used to display a line of text. Shell redirection (>, >>) is
used to redirect the output of a command to a file.
 Example:
 echo "Hello, world!" > output.txt: Writes "Hello, world!" to output.txt.
 echo "More text" >> output.txt: Appends "More text" to output.txt.

You might also like