Certainly! Here are some additional Bash commands along with their explanations:
-
Display current working directory:
pwdThis command shows the full path of the current directory you are in.
-
View the first few lines of a file:
head filename.txtThis displays the first 10 lines of the specified file. You can specify a different number of lines with
-n, e.g.,head -n 5 filename.txt. -
View the last few lines of a file:
tail filename.txtThis shows the last 10 lines of the file. Use
-nto specify a different number, e.g.,tail -n 5 filename.txt. -
Find files and directories:
find /path/to/search -name "filename"This searches for files and directories matching the specified name in the given path.
-
Redirect output to a file:
command > output.txtThis runs a command and saves its output to
output.txt. Use>>to append instead of overwrite. -
Combine commands with pipes:
command1 | command2This takes the output of
command1and uses it as input forcommand2. For example,ls | grep "txt"lists files and filters for those containing "txt". -
Check disk usage:
df -hThis displays disk space usage for all mounted filesystems in a human-readable format.
-
Check memory usage:
free -hThis shows memory usage, including total, used, and free memory, in a human-readable format.
-
Change file permissions:
chmod 755 filenameThis changes the permissions of a file.
755means the owner can read, write, and execute; others can read and execute. -
Create a symbolic link:
ln -s target_file link_nameThis creates a symbolic link named
link_namethat points totarget_file.
These commands are useful for various tasks in a Bash environment. If you have specific areas of interest or need further explanations, let me know!
