Linux തുടക്കക്കാർക്കുള്ള 15 അടിസ്ഥാന ls കമാൻഡ് ഉദാഹരണങ്ങൾ


ലിനക്സിൽ ഏറ്റവും കൂടുതൽ ഉപയോഗിക്കുന്ന കമാൻഡുകളിൽ ഒന്നാണ് ls കമാൻഡ്. നിങ്ങൾ Linux Box-ന്റെ കമാൻഡ് പ്രോംപ്റ്റിൽ പ്രവേശിക്കുമ്പോൾ നിങ്ങൾ ഉപയോഗിക്കുന്ന ആദ്യത്തെ കമാൻഡ് ls കമാൻഡ് ആണെന്ന് ഞാൻ വിശ്വസിക്കുന്നു.

ഞങ്ങൾ ls കമാൻഡ് തന്ത്രങ്ങൾ ഉപയോഗിക്കുന്നു.

[ You might also like: Linux കമാൻഡുകൾ എന്നെന്നേക്കുമായി ഓർമ്മിക്കാൻ 5 ഉപയോഗപ്രദമായ ഉപകരണങ്ങൾ ]

ഈ ലേഖനത്തിൽ, Linux-ൽ ലഭ്യമായ എല്ലാ പാരാമീറ്ററുകളും ഉപയോഗിച്ച് ls കമാൻഡ് ഉദാഹരണങ്ങളുടെ അടിസ്ഥാനകാര്യങ്ങൾ ഞങ്ങൾ ചർച്ച ചെയ്യും.

ഫയൽ തരങ്ങൾ, വലുപ്പം, പരിഷ്uക്കരിച്ച തീയതിയും സമയവും, അനുമതിയും ലിങ്കുകളും മുതലായ വിശദാംശങ്ങൾ കാണാൻ സാധിക്കാത്ത ഒരു നഗ്നമായ ഫോർമാറ്റിൽ, ഓപ്uഷൻ ലിസ്റ്റ് ഫയലുകളും ഡയറക്uടറികളും ഇല്ലാതെ ls കമാൻഡ് പ്രവർത്തിപ്പിക്കുന്നു.

# ls

0001.pcap         Desktop             Downloads         
index.html        install.log.syslog  Pictures  
Templates         anaconda-ks.cfg     Documents           
fbcmd_update.php  install.log         Music
Public            Videos

ഇവിടെ, ls -l (-l എന്നത് ഒരു പ്രതീകമാണ്, ഒന്നല്ല) ഫയൽ അല്ലെങ്കിൽ ഡയറക്ടറി, വലുപ്പം, പരിഷ്കരിച്ച തീയതിയും സമയവും, ഫയലിന്റെ അല്ലെങ്കിൽ ഫോൾഡറിന്റെ പേരും ഫയലിന്റെ ഉടമയും അതിന്റെ അനുമതിയും കാണിക്കുന്നു.

# ls -l

total 176
-rw-r--r--. 1 root root   683 Aug 19 09:59 0001.pcap
-rw-------. 1 root root  1586 Jul 31 02:17 anaconda-ks.cfg
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Documents
drwxr-xr-x. 4 root root  4096 Aug 16 02:55 Downloads
-rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php
-rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Videos

.’ എന്നതിൽ തുടങ്ങുന്ന മറഞ്ഞിരിക്കുന്ന ഫയലുകൾ ഉൾപ്പെടെ എല്ലാ ഫയലുകളും ലിസ്റ്റ് ചെയ്യുക.

# ls -a

.                .bashrc        Documents       .gconfd          
install.log      .nautilus      .pulse-cookie
..               .cache         Downloads       .gnome2          
install.log      .netstat.swp   .recently-used.xbel
0001.pcap        .config        .elinks         .gnome2_private  
.kde             .opera         .spice-vdagent
anaconda-ks.cfg  .cshrc         .esd_auth         .gtk-bookmarks   
.libreoffice      Pictures      .tcshrc
.bash_history    .dbus          .fbcmd            .gvfs            
.local              .pki         Templates
.bash_logout     Desktop        fbcmd_update.php  .ICEauthority    
.mozilla            Public        Videos
.bash_profile    .digrc         .gconf           index.html       
Music           .pulse          .wireshark

-lh ഓപ്ഷന്റെ സംയോജനത്തോടെ, മനുഷ്യർക്ക് വായിക്കാൻ കഴിയുന്ന ഫോർമാറ്റിൽ വലുപ്പങ്ങൾ കാണിക്കുന്നു.

# ls -lh

total 176K
-rw-r--r--. 1 root root  683 Aug 19 09:59 0001.pcap
-rw-------. 1 root root 1.6K Jul 31 02:17 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Documents
drwxr-xr-x. 4 root root 4.0K Aug 16 02:55 Downloads
-rw-r--r--. 1 root root  21K Aug 12 12:42 fbcmd_update.php
-rw-r--r--. 1 root root  46K Jul 31 09:58 index.html
-rw-r--r--. 1 root root  48K Jul 31 02:17 install.log
-rw-r--r--. 1 root root  12K Jul 31 02:13 install.log.syslog
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Music
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Public
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Templates
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Videos

ls കമാൻഡിനൊപ്പമുള്ള -F ഓപ്ഷൻ ഉപയോഗിക്കുന്നത് ഓരോ ഡയറക്ടറിയുടെയും അവസാനം / പ്രതീകം ചേർക്കും.

# ls -F

0001.pcap        Desktop/    Downloads/        index.html   
install.log.syslog  Pictures/  Templates/
anaconda-ks.cfg  Documents/  fbcmd_update.php  install.log  
Music/              Public/    Videos/

ls -r ഓപ്ഷനുള്ള ഇനിപ്പറയുന്ന കമാൻഡ് ഫയലുകളും ഡയറക്ടറികളും വിപരീത ക്രമത്തിൽ പ്രദർശിപ്പിക്കുന്നു.

# ls -r

Videos     Public    Music               install.log  
fbcmd_update.php  Documents  anaconda-ks.cfg
Templates  Pictures  install.log.syslog  index.html   
Downloads         Desktop    0001.pcap

ls -R ഓപ്ഷൻ വളരെ ദൈർഘ്യമേറിയ ലിസ്റ്റിംഗ് ഡയറക്ടറി ട്രീകൾ ലിസ്റ്റ് ചെയ്യും. കമാൻഡിന്റെ ഔട്ട്പുട്ടിന്റെ ഒരു ഉദാഹരണം കാണുക.

# ls -R

total 1384
-rw-------. 1 root     root      33408 Aug  8 17:25 anaconda.log
-rw-------. 1 root     root      30508 Aug  8 17:25 anaconda.program.log

./httpd:
total 132
-rw-r--r--  1 root root     0 Aug 19 03:14 access_log
-rw-r--r--. 1 root root 61916 Aug 10 17:55 access_log-20120812

./lighttpd:
total 68
-rw-r--r--  1 lighttpd lighttpd  7858 Aug 21 15:26 access.log
-rw-r--r--. 1 lighttpd lighttpd 37531 Aug 17 18:21 access.log-20120819

./nginx:
total 12
-rw-r--r--. 1 root root    0 Aug 12 03:17 access.log
-rw-r--r--. 1 root root  390 Aug 12 03:17 access.log-20120812.gz

-ltr-ന്റെ സംയോജനം ഏറ്റവും പുതിയ പരിഷ്uക്കരണ ഫയലോ ഡയറക്uടറി തീയതിയോ അവസാനമായി കാണിക്കും.

# ls -ltr

total 176
-rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-------. 1 root root  1586 Jul 31 02:17 anaconda-ks.cfg
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Videos
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Documents
-rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html
-rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php
drwxr-xr-x. 4 root root  4096 Aug 16 02:55 Downloads
-rw-r--r--. 1 root root   683 Aug 19 09:59 0001.pcap

ക്രമത്തിൽ -lS ഡിസ്പ്ലേകളുടെ ഫയൽ വലുപ്പം സംയോജിപ്പിച്ച്, ആദ്യം വലുപ്പത്തിൽ വലുതായി പ്രദർശിപ്പിക്കും.

# ls -lS

total 176
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html
-rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php
-rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Documents
drwxr-xr-x. 4 root root  4096 Aug 16 02:55 Downloads
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root  4096 Jul 31 02:48 Videos
-rw-------. 1 root root  1586 Jul 31 02:17 anaconda-ks.cfg
-rw-r--r--. 1 root root   683 Aug 19 09:59 0001.pcap

ഫയൽ/ഡയറക്uടറി പേരിന് മുമ്പ് പ്രിന്റ് ചെയ്uതിരിക്കുന്ന ചില നമ്പറുകൾ നമുക്ക് കാണാൻ കഴിയും. -i ഓപ്uഷനുകൾക്കൊപ്പം ഒരു ഐനോഡ് നമ്പറുള്ള ഫയൽ/ഡയറക്uടറി ലിസ്റ്റ് ചെയ്യുക.

# ls -i

20112 0001.pcap        23610 Documents         23793 index.html          
23611 Music            23597 Templates         23564 anaconda-ks.cfg  
23595 Downloads        22 install.log         23612 Pictures  23613 Videos
23594 Desktop          23585 fbcmd_update.php     35 install.log.syslog  
23601 Public

ls കമാൻഡിന്റെ പതിപ്പ് പരിശോധിക്കുക.

# ls --version

ls (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.

ls കമാൻഡിന്റെ സഹായ പേജ് അവരുടെ ഓപ്ഷനുമായി.

# ls --help

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

/tmp എന്ന ഡയറക്ടറിക്ക് കീഴിലുള്ള ls -l കമാൻഡ് ലിസ്റ്റ് ഫയലുകൾക്കൊപ്പം. ഇതിൽ -ld പാരാമീറ്ററുകൾക്കൊപ്പം /tmp ഡയറക്ടറിയുടെ വിവരങ്ങൾ പ്രദർശിപ്പിക്കുന്നു.

# ls -l /tmp
total 408
drwx------. 2 narad narad   4096 Aug  2 02:00 CRX_75DAF8CB7768
-r--------. 1 root  root  384683 Aug  4 12:28 htop-1.0.1.tar.gz
drwx------. 2 root  root    4096 Aug  4 11:20 keyring-6Mfjnk
drwx------. 2 root  root    4096 Aug 16 01:33 keyring-pioZJr
drwx------. 2 gdm   gdm     4096 Aug 21 11:26 orbit-gdm
drwx------. 2 root  root    4096 Aug 19 08:41 pulse-gl6o4ZdxQVrX
drwx------. 2 narad narad   4096 Aug  4 08:16 pulse-UDH76ExwUVoU
drwx------. 2 gdm   gdm     4096 Aug 21 11:26 pulse-wJtcweUCtvhn
-rw-------. 1 root  root     300 Aug 16 03:34 yum_save_tx-2012-08-
16-03-34LJTAa1.yumtx
# ls -ld /tmp/

drwxrwxrwt. 13 root root 4096 Aug 21 12:48 /tmp/

ഫയലുകളുടെയും ഡയറക്uടറികളുടെയും UID, GID എന്നിവ പ്രദർശിപ്പിക്കുന്നതിന്. ls കമാൻഡിനൊപ്പം ഓപ്ഷൻ -n ഉപയോഗിക്കുക.

# ls -n

total 36
drwxr-xr-x. 2 500 500 4096 Aug  2 01:52 Downloads
drwxr-xr-x. 2 500 500 4096 Aug  2 01:52 Music
drwxr-xr-x. 2 500 500 4096 Aug  2 01:52 Pictures
-rw-rw-r--. 1 500 500   12 Aug 21 13:06 tmp.txt
drwxr-xr-x. 2 500 500 4096 Aug  2 01:52 Videos

ls കമാൻഡിന് ഞങ്ങൾ ഒരു അപരനാമം ഉണ്ടാക്കിയിട്ടുണ്ട്, ഞങ്ങൾ ls കമാൻഡ് എക്സിക്യൂട്ട് ചെയ്യുമ്പോൾ അത് ഡിഫോൾട്ടായി -l ഓപ്ഷൻ എടുക്കുകയും നേരത്തെ സൂചിപ്പിച്ചതുപോലെ ഒരു നീണ്ട ലിസ്റ്റിംഗ് പ്രദർശിപ്പിക്കുകയും ചെയ്യും.

# alias ls="ls -l"

കുറിപ്പ്: താഴെയുള്ള അപരനാമ കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങളുടെ സിസ്റ്റത്തിൽ ലഭ്യമായ നിരവധി അപരനാമങ്ങൾ നമുക്ക് കാണാൻ കഴിയും, അവ താഴെ കാണിച്ചിരിക്കുന്നതുപോലെ അപരനാമങ്ങളാകാം.

# alias

alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

മുമ്പ് നിർവ്വചിച്ച ഒരു അപരനാമം നീക്കം ചെയ്യാൻ, unalias കമാൻഡ് ഉപയോഗിക്കുക.

# unalias ls

[ നിങ്ങൾക്ക് ഇതും ഇഷ്ടപ്പെടാം: ലിനക്സിൽ അപരനാമ കമാൻഡ് എങ്ങനെ സൃഷ്ടിക്കാം, ഉപയോഗിക്കാം ]

ഞങ്ങളുടെ അടുത്ത ലേഖനത്തിൽ, ls കമാൻഡിലെ കൂടുതൽ ചോദ്യങ്ങൾ ഞങ്ങൾ മറയ്ക്കുകയോ അഭിമുഖം നടത്തുകയോ ചെയ്യും, കൂടാതെ ലിസ്റ്റിൽ എന്തെങ്കിലും നഷ്uടപ്പെട്ടിട്ടുണ്ടെങ്കിൽ, ദയവായി അഭിപ്രായ വിഭാഗം വഴി ഞങ്ങളെ അപ്uഡേറ്റ് ചെയ്യുക.