top of page
Writer's pictureMukesh Chanderia

Linux - Basic Commands Part 2

Updated: Aug 21, 2021


root@localhost ~]# ls --help

Usage: ls [OPTION]... [FILE]...

List information about the FILEs (the current directory by default).

Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.


Mandatory arguments to long options are mandatory for short options too.

-a, --all do not ignore entries starting with .

-A, --almost-all do not list implied . and ..

--author with -l, print the author of each file

-b, --escape print C-style escapes for nongraphic characters

--block-size=SIZE scale sizes by SIZE before printing them; e.g.,


Commands to create files : Touch


Touch command does two things :

1) Create empty file if not present.

2) Update timestamp if already present.


root@localhost ~]# touch abc{1..10}

[root@localhost ~]# ls

{1--10} abc{1--10} abc5 abc9 Downloads Public

abc abc2 abc6 anaconda-ks.cfg initial-setup-ks.cfg Templates

abc1 abc3 abc7 Desktop Music test

abc10 abc4 abc8 Documents Pictures Videos


root@localhost ~]# stat abc : To see timestamps

File: ‘abc’

Size: 0 Blocks: 0 IO Block: 4096 regular empty file

Device: 802h/2050d Inode: 16967444 Links: 1

Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2021-01-11 00:36:21.223219139 +0530

Modify: 2021-01-11 00:36:21.223219139 +0530

Change: 2021-01-11 00:36:21.223219139 +0530


To make folder with space

root@localhost ~]# mkdir mukesh\ monu --> mukesh monu


Also we can use comma "mukesh monu"

cd mukesh\ monu or cd "mukesh monu"


To create folder Life in directory Mukesh

mkdir Mukesh/Life


If folder does not exist already then use "-p"

mkdir -p Mukesh/Life


CAT : Command "cat >" to create file


root@localhost ~]# cat > mukesh.txt

Hello Ji

Tuse Great Ho

You Can

You Will

Great

Control+D to save file


CAT : Command "cat" to print file


[root@localhost ~]# cat mukesh.txt

Hello Ji

Tuse Great Ho

You Can

You Will

Great


"-n" to put number before file lines


[root@localhost ~]# cat -n mukesh.txt

1 Hello Ji

2 Tuse Great Ho

3 You Can

4 You Will

5 Great



15 views0 comments

Comments


bottom of page