Putting commands together
Often you will find you need to use different commands on the same line. Here are some examples.
Note that the | character is called a pipe, it takes date from one program and pipes it to another.
> means create a new file, overwriting any content already there.
>> means to append data to a file, creating a newone if it doesn not already exist.
< send input from a file back into a command.
- # grep User /usr/local/apache/conf/httpd.conf |more
- This will dump all lines that match User from the httpd.conf, then print the results to your screen one page at a time.
- last -a > /root/lastlogins.tmp
- This will print all the current login history to a file called lastlogins.tmp in /root/
- tail -10000 /var/log/exim_mainlog |grep domain\.com |more
- This will grab the last 10,000 lines from /var/log/exim_mainlog, find all occurrences of domain.com (the period represents 'anything',
- -- comment it out with a \ so it will be interpretted literally), then send it to your screen page by page.
- netstat -an |grep :80 |wc -l
- Shows how many active connections there are to apache (httpd runs on port 80).
- mysqladmin processlist |wc -l
- Shows how many current open connections there are to mysql.
And that is not even scratching the surface! For more information on using linux and the command line, we have selected some of the following links. Please keep in mind that Cpanel,Inc is not responsible for content on other sites.
Was this answer helpful?
This will show all SETUID and SETGID files on the server (assuming a good integrity of the 'find'...
If you believe you are under a SYN attack, run the following command: * netstat...
Use the last command.Example: last -30 will displaly the last 30 people.
There are many recommendations for DNS zone settings, Here are mine as follows: ...
The following is a breakdown of the most commonly used commands and the most commonly used...