cut
How to cut lines separated by multiple spaces?
Here is an example of cut command, that will remove all PHP packages from system
1 |
dpkg -l | grep php | cut -d" " -f3 | xargs apt purge -y |
Get user names
1 |
cut -d':' -f1 /etc/passwd |
Display users with SSH enabled
1 |
grep "/bin/bash" /etc/passwd | cut -d':' -f1,6 |
List all IPs that have accessed admin area from Apache Log
1 |
cat LOG_FILE_NAME_HERE | grep '/admin/' | cut -d' ' -f1 | sort -n | uniq |
See Linux Commands