Skip to content

Commit 5645427

Browse files
authored
Update LinuxCommands
1 parent 6119fdc commit 5645427

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

LinuxFundamentals/LinuxCommands

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,77 @@ chmod o-x file1
605605

606606

607607

608+
list all users account using the /etc/passwd file
609+
$ cat /etc/passwd
608610

611+
Each line in the file has seven fields as follows. For example, consider the following line:
612+
vnstat:x:131:137:vnstat daemon,,,:/var/lib/vnstat:/usr/sbin/nologin
609613

614+
Where,
610615

616+
vnstat – The user name or login name.
617+
x – Encrypted password is stored in the /etc/shadow file.
618+
131 – UID (user ID number)
619+
137 – Primary GID (group ID number)
620+
vnstat daemon – GECOS. It may includes user’s full name (or application name, if the account is for a program), building and room number or contact person, office telephone number, home telephone number and any other contact information.
621+
/var/lib/vnstat – Home directory for the user.
622+
/usr/sbin/nologin – Login shell for the user. Pathnames of valid login shells comes from the /etc/shells file.
611623

612624

625+
********************
626+
Of course we can use pagers such as more/less commands as follows to view the /etc/passwd file:
627+
$ more /etc/passwd
613628

629+
it will show how more pages with content are left
614630

631+
$ less /etc/passwd
615632

633+
you can access the file using up and down arrow
616634

635+
*********************
636+
637+
limit outputs using the head command and tail command as follows:
638+
tail -5 /etc/passwd -- show last 5 users
639+
head -5 /etc/passwd -- shows top 5 users
640+
641+
642+
********************
643+
644+
To list only usernames type the following awk command:
645+
646+
$ awk -F':' '{ print $1}' /etc/passwd
647+
648+
649+
Sample outputs:
650+
651+
root
652+
daemon
653+
bin
654+
sys
655+
sync
656+
games
657+
man
658+
lp
659+
660+
661+
662+
663+
Refer : https://www.cyberciti.biz/faq/linux-list-users-command/
664+
665+
**********************************
666+
You need to use rpm command to display all installed packages in Linux.
667+
668+
Red Hat/Fedora Core/CentOS Linux
669+
Type the following command to get list of all installed software
670+
# rpm -qa | less
671+
672+
Debian Linux
673+
Type the following command to get list of all installed software:
674+
# dpkg --get-selections
675+
676+
Ubuntu Linux
677+
Type the following command to get list of all installed software:
678+
# sudo dpkg --get-selections
617679

618680

619681

0 commit comments

Comments
 (0)