Categories: Linux; Tagged with: ; @ May 8th, 2014 21:50

[email protected] /tmp $ grep ‘hi’ test1.txt

# Display line number
[email protected] /tmp $ grep -n ‘hi’ test1.txt
3: hi

# Count
[email protected] /tmp $ grep -c ‘hi’ test1.txt

# Case insensitive
[email protected] /tmp $ grep -n -i ‘hi’ test1.txt
1: HI
2: Hi
3: hi

# Search the whole word
[email protected] /tmp $ grep -n -w ‘hi’ test1.txt
3: hi

# Search recursively
[email protected] /tmp $ grep -n -w ‘hi’ -r  test*
test1.txt:3: hi

# Use grep in Pipes
GDEV tmp # find . -name ‘test*’ |xargs grep ‘hi’
./test1.txt: hi
./test2:Hi, this is test2;
./test3:this is test 3

Run Shell command using PHPShell in your shared host

Categories: PHP; Tagged with: ; @ June 23rd, 2012 13:19

PHP has a shell_exec command: “Execute command via shell and return the complete output as a string ”

And here is a project:

PHP Shell

PHP Shell is a shell wrapped in a PHP script. It’s a tool you can use to execute arbitrary shell-commands or browse the filesystem on your remote webserver. This replaces, to a degree, a normal telnet connection, and to a lesser degree a SSH connection.

You use it for administration and maintenance of your website, which is often much easier to do if you can work directly on the server. For example, you could use PHP Shell to unpack and move big files around. All the normal command line programs like ps, free, du, df, etc… can be used.

Download and config phpShell,, and then upload to your server, then you can run shell!

// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.