Contents
Hi everyone, Today I will show you some commands on Linux very useful
– display your current working directory
pwd
– created directory dir1
mkdir -v dir1
– create more than one directory instead of invoking mkdir multiple(three) times-like
mkdir -vp dir2/dir3/dir4
– listed all directories and files in current directories
ls
– move into directory dir1
cd dir1
– move to parent directory
cd ..
2. Create files, display contents and stats
– create file file1.txt
touch file1.txt
– clear a screen
clear
3. Copy,rename,delete files
– copy hello.txt
to dir2
directory.
cp -v hello.txt dir2
– move hello.txt
to dir4
directory with name hi.txt
mv hello.txt dir2/dir3/dir4/hi.txt
– remove directories dir1
rm -rf dir1
4. Manipulate or parse file contents
– searches for matching words or line on the file To search entire directory of files, supply the directory name
grep -r 'Hello'
– change file access permission
chmod -v 666 file1.txt
You should have seen a output like mode of file1.txt changed to 0666 (rw-rw-rw-)
– change owner
chown -R newowner:newowner *
– searches for files in a directory hierarchy
find . -name file1.txt
– view and edit file
nano file1.txt
Done. Hope this article will helpful for you.