Hi everyone, Today I will show you some commands on Linux very useful

1. Basic commands to navigate directories

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

If your website is having problems, please leave a comment below or contact us at Magepow Contact, the Magepow technician team will assist in solving your problem quickly. Thanks.

Hope this article will helpful for you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending