- Linux Admin Tutorial
- Home
- CentOS Overview
- Basic CentOS Linux Commands
- File / Folder Management
- User Management
- Quota Management
- Systemd Services Start and Stop
- Resource Mgmt with systemctl
- Resource Mgmt with crgoups
- Process Management
- Firewall Setup
- Configure PHP in CentOS Linux
- Set Up Python with CentOS Linux
- Configure Ruby on CentOS Linux
- Set Up Perl for CentOS Linux
- Install and Configure Open LDAP
- Create SSL Certificates
- Install Apache Web Server CentOS 7
- MySQL Setup On CentOS 7
- Set Up Postfix MTA and IMAP/POP3
- Install Anonymous FTP
- Remote Management
- Traffic Monitoring in CentOS
- Log Management
- Backup and Recovery
- System Updates
- Shell Scripting
- Package Management
- Volume Management
- Linux Admin Useful Resources
- Linux Admin - Quick Guide
- Linux Admin - Useful Resources
- Linux Admin - Discussion
Linux Admin - wc Command
wc is useful for counting occurrences in a file. It helps print newline, word, ad byte count from each file. Most useful is when combined with grep to show matches for a certain pattern.
Switch | Action |
---|---|
-c | Bytes |
-m | Character count |
-l | Line count |
-L | Length of the longest line |
We can see our system has 5 users with a group id of 0. Then upon further inspection only the root user has shell access.
[root@centosLocal centos]# cat /etc/passwd | cut -d":" -f4 | grep "^0" | wc -l 5 [root@centosLocal centos]# cat /etc/passwd | cut -d":" -f4,5,6,7 | grep "^0" 0:root:/root:/bin/bash 0:sync:/sbin:/bin/sync 0:shutdown:/sbin:/sbin/shutdown 0:halt:/sbin:/sbin/halt 0:operator:/root:/sbin/nologin [root@centosLocal centos]#
basic_centos_linux_commands.htm
Advertisements