冰芹的 Notes

Linux basic commands

创建于 2026-04-18T12:55:48

echo

#print
echo hello

pwd

#where you are
pwd

cd

#change directory
cd .. #parent directory
cd ~ #home directory
cd - #last directory

ls

#list directories
#-a for all file
#-l for information
ls

touch

#create file
touch hello

file

#description of file
file hello

cat

#print file content
cat hello

less

#read file
less hello

history

history

clear

clear

cp

cp hello /home/pete
cp -r #copy over the directory and files inside
cp -i #prompt you before overwriting

Wildcards

    • represent all single characters or any string.
  • ? used to represent one character
  • [] used to represent any character within the brackets
cp *.jpg /home/pete/Pictures

mv

mv helle hello #rename
mv hello user/kevin #move
mv -i #prompt you berfore overwriting
mv -b #overwrite and make a backup

mkdir

create directory

mkdir books
mkdir -p books/harry #make the subdirectories at the same time

rm

rm -f #force
rm -i #prompt you before removing
rm -r #remove directory and all files in it
rmdir #remove directory

find

find /home -type d -name MyFolder

helping commands

help ls
man ls
whatis ls

alias

exit

Reference

https://linuxjourney.com/lesson/the-shell