Support Center > Knowledgebase > Web Host Manager > cPanel and Linux > Putting commands together
Putting commands together
Often, you will find that you need to use different commands on the same line. Here are some examples.
Note that the | character is called a pipe, it takes data 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 new one if it does not already exist.
< send input from a file back into a command.
- # grep User /usr/local/apache/conf/httpd.conf |more
- This will find 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/.
- ail -10000 /var/log/exim_mainlog |grep domain\.com |more
- This will grab the last 10,000 lines from /var/log/exim_mainlog, and find all occurrences of domain.com (the period normally represents 'anything' — comment it out with a \ so it will be interpreted 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).
- mysql --skip-column-names --batch -e 'show processlist' | wc -l
- This command shows the number of MySQL threads. If subselects start new threads, they will be included in the output of 'show processlist'.
Also Read