![]() ![]() You can use the ps command to see which processes are running on your system as user www-data, for example: ps -ef | grep www-data The output of a command can be filtered using grep and pipe, with just the lines matching a specific pattern being printed on the terminal. Use Grep to Filter the Output of a Command To print the lines that do not contain the string nologin, for example, type: grep -v nologin /etc/passwdĬolord:x:124:124::/var/lib/colord:/bin/false Use the -v (or -invert-match) option to display lines that do not match a pattern. If the string contains spaces, use single or double quotation marks to surround it: grep "Gnome Display Manager" /etc/passwd This is what the output should look like: root:x:0:0:root:/root:/bin/bash The grep command's most basic use is to look for a string (text) in a file.įor example, to see all the entries in the /etc/passwd file that contains the string bash, use the following command: grep bash /etc/passwd The user performing the command must have read access to the file in order to search it. grep has a lot of settings that govern how it behaves.
0 Comments
Leave a Reply. |