file commands:
- PWD – print current working directory
pwd
- ls – list all files and directory
ls - current location files
ls -a list all files & hideen files
ls -l show files details with long format
ls -h human readable
ls -R list all subdirectory also
- Change directory:
cd - path of the location
cd /path/location
# come one step back from current directory
cd ../
# multiple steps back
cd ../../
- touch – create files
touch file1.txt - create file
touch file2.txt file3.txt file4.txt - create multiple files at once
touch foldername/filename - specific location need create file
- mkdir – create folders
mkdir hellowd # single directory
mkdir demo demo2 demo3
mkdir demo/data demo2/db demo3/ai
mkdir -p demo4/development
mkdir -p demo5/development demo6/qa demo7/test
- cat – print containt in the file
cat file path
- head – Print the first 10 lines of each FILE to standard output.
head file path
head -n 2 file names
head --lines
- tail – Print the last 10 lines of each FILE to standard output
tail file path
tail -n 2 file names
tail --lines
- grep – grep, egrep, fgrep, rgrep – print lines that match patterns
cat filename | grep string
cat hello.txt | grep demo
- copy files
cp source desc
cp demo/data/demo.txt demo5/development/demo1.txt
cp demo/data/demo.txt demo5/development/demo2.txt
cp -r dem* data/
- move/rename folder and files
mv source desc
mv dem* /data/
