Posts Tagged ‘Commands’

Tip of the Day: Create account same as root

Monday, April 19th, 2010

I learned something new today, create an account that has the same privileges as root. And I have no plans of creating a home directory for this, I discovered something that will lessen the task.

It goes this way:

root@localhost ~]# adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M

Tip of the Day: find string in a file via commandline

Friday, November 13th, 2009

Sometimes we want to know if certain words or strings are in a file.

Fear not, here’s a simple way to do it:

root@localhost ~]# fgrep <keyword> <filename>

Let’s say I’m searching for the string ‘copy’ inside a shell script called check:

root@localhost ~]# fgrep copy check

I’ll get the entire line:

“Copy not finished”;

Can’t run basic commands in console

Tuesday, August 18th, 2009

For the first time, an incident of being unable to execute ‘ls’ happened.

The issue was, he can run it via /usr/bin/ls but not just ls.

The solution is, check environment variables: echo $PATH

if the absolute path of executable files is not shown, add it by:

PATH=”directory:$PATH”

e.g

PATH=”/usr/sbin:$PATH”

or

export PATH=$PATH:/usr/sbin

Tip of the Day: Restricted Shared Folder

Monday, May 11th, 2009

If you want to create a shared folder that only has write and execute privileges for ‘Everyone,’ using GUI is as easy as a few clicks.

But if you’re thinking of doing it the geeky way, here’s how.

In command line, type in;

root@localhost ~]# chmod 333 MyFolder

And that’s it!!

QuickPress: print non-matching lines (results) with grep

Tuesday, April 28th, 2009

It’s as simple as:

root@localhost ~]# ls | grep -v