pwd
to print your current working directoryls
to list files in the current directoryls -l
for detailed file informationcd
to change directoriescd ..
to go up one directorycd ~
to return to your home directorypractice
using mkdir
touch myfile.txt
cp myfile.txt myfile_backup.txt
mv myfile.txt newname.txt
rm myfile_backup.txt
rmdir
echo "Hello World" > hello.txt
cat hello.txt
less
to view longer fileshead
and tail
to see the beginning/end of filesfind
to search for files in the current directoryfind . -name "*.txt"
to find all .txt
files in the current directorychmod
to change file permissionschmod +x script.sh
to make a script executablechmod
is used to change the permissions of a file. The +x
option adds execute permission to the file. You can change the permissions for different users (owner, group, others) using different combinations of u
, g
, o
, and a
.chmod u+x script.sh
adds execute permission to the owner of the file.mkdir -p projects
script.sh
:
secure_files
ls -l
Create a directory structure to practice with, copy the following commands and run them in the terminal:
mkdir -p findme/level1/level2 findme/level1/level3
touch findme/file1.txt
touch findme/level1/file2.txt
touch findme/level1/level2/file3.txt
touch findme/level1/level3/file4.txt
touch findme/level1/level3/script.sh
Your tasks:
Find all .txt
files in the findme directory
Find files modified in the last 10 minutes
Zip all files in the findme directory
Hint: Look up how to use find
and zip