Sure! Here are more examples of useful Bash shortcuts and commands:
-
~(Home Directory):cd ~/DocumentsNavigates to the Documents folder in your home directory.
-
.(Current Directory):cp file.txt ./backup/Copies
file.txtto thebackupdirectory within the current directory. -
..(Parent Directory):cd ../..Moves up two directory levels.
-
-(Previous Directory):cd -Switches back to the last directory you were in.
-
$PATH(Executable Path):export PATH=$PATH:/new/directoryAdds a new directory to your executable path.
-
*(Wildcard):rm *.logDeletes all files with a
.logextension in the current directory. -
?(Single Character Wildcard):ls file?.txtLists files like
file1.txt,file2.txt, etc. -
&(Background Process):python script.py &Runs
script.pyin the background. -
Ctrl + C(Cancel Command):- Use this to stop a running command, like a long-running script.
-
Ctrl + Z(Suspend Command):- Suspends a running command, which you can resume with
fg(foreground) orbg(background).
- Suspends a running command, which you can resume with
-
history:historyDisplays a list of previously executed commands.
-
!!(Repeat Last Command):!!Repeats the last command you executed.
-
!n(Repeat Command by Number):!100Executes the command listed as number 100 in your history.
These examples illustrate how you can use shortcuts and commands to navigate and manage files efficiently in the Bash shell. If you need more specific examples or have a particular use case in mind, let me know!
