Common bash commands
cd
- Change directory, e.g. cd /public/themes/
ls
- List files & directories
TIP
Useful flags:
-a
- Include directory entries whose names begin with a dot (.).
-l
- List in long format.
cat <file>
- Print the contents of a file out, e.g. cat statamic.log
will output the entire file
tail <file>
- Print the content of a file out, similar to cat
, e.g. tail stamic.log
TIP
Useful flags:
-f
- Do not stop when end of file is reached, but rather to wait for additional data to be appended to the input
rm <file/dir>
- Remove a file
TIP
Useful flags:
-d
- Attempt to remove directories as well as other types of files.
-R
- Has -d
implied, recursively removes descendant directories/files.
-f
- Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.
mkdir <new dir name>
- Make a new directory in the current directory, e.g. mkdir pictures
TIP
Useful flags:
-p
- Specify a longer path to create multiple directories at once. e.g. mkdir -p assets/images/svg
rmdir <existing dir name>
- Remove a directory
pwd
- Displays the path to the current directory.
touch <file>
- Create a new file
cp
- Copy specified file to a new named file. Use -r flag to copy a directory.
mv <source> <renamed source>
- Rename a specified file or directory.
mv <source> <new location>
- Move a specified directory, e.g. mv README.md ../public/