The postion of any file is described by its pathname.Elements of pathname seperated by '/' front slash.
Absolute path: Mentioned from Root
Ex: /c/users/uday/Desktop/a
Relative path: from current directory
Ex: Desktop/a
cd .. --- goes to parent directory
Ex: from /c/users/uday to /c/users
cd ../.. -- goes to parent's parent
Ex: from /c/users/uday to /c
mkdir dirname -- to create a directory in current working directory.
rmdir dirname -- to delete a directory
mv <name> <new_name> --renaming directory
touch test -- create an empty file with the name provided
ls -la
To list hidden files also.
File/Folder with dot(.) in front, is a hidden one.
ls * --- it shows recursively all files
* -- All possible values -- represents everything
ls -l | head
| -- pipe: used to pass output of one command left side to right side.
touch 1 2 3 4 -- creates 4 files with respective names
rm * -- deletes all files in current directory.
rm -rf testing/ -- recursively and forcibly.
cp TEST1 TEST2 -- a new copy is created with different name.
mv: move or rename
mv TEST1 TEST3 -- renamed TEST1 to TEST3
mv TEST1 chef_recipe/TEST1 -- moved to chef_recipe folder with target name mentioned.
Traversing file contents:
--------------------------
cat file1 -- to see contents
vim file1 -- vim editor
head file1 -- First 10 lines printed
head -2 file1 -- first 2 lines
tail -- reverse of head
Absolute path: Mentioned from Root
Ex: /c/users/uday/Desktop/a
Relative path: from current directory
Ex: Desktop/a
cd .. --- goes to parent directory
Ex: from /c/users/uday to /c/users
cd ../.. -- goes to parent's parent
Ex: from /c/users/uday to /c
mkdir dirname -- to create a directory in current working directory.
rmdir dirname -- to delete a directory
mv <name> <new_name> --renaming directory
touch test -- create an empty file with the name provided
ls -la
To list hidden files also.
File/Folder with dot(.) in front, is a hidden one.
ls * --- it shows recursively all files
* -- All possible values -- represents everything
ls -l | head
| -- pipe: used to pass output of one command left side to right side.
touch 1 2 3 4 -- creates 4 files with respective names
rm * -- deletes all files in current directory.
rm -rf testing/ -- recursively and forcibly.
cp TEST1 TEST2 -- a new copy is created with different name.
mv: move or rename
mv TEST1 TEST3 -- renamed TEST1 to TEST3
mv TEST1 chef_recipe/TEST1 -- moved to chef_recipe folder with target name mentioned.
Traversing file contents:
--------------------------
cat file1 -- to see contents
vim file1 -- vim editor
head file1 -- First 10 lines printed
head -2 file1 -- first 2 lines
tail -- reverse of head
No comments:
Post a Comment