878 reputation
510
bio website
location
age
visits member for 5 years, 4 months
seen Aug 11 at 12:17

Feb
21
comment How to list installed man pages and search in many mans?
man apropos, apropos string
Jun
5
comment Creating a file through a dangling symlink with vi
cat ~/non_exist The link refers to a relative path, and the relative path of non_exist from ~/link is ~/non_exist
Jun
3
comment what is -z option in test command(linux)
You must be careful with the quoting. test -n $foo is a disaster waiting to happen because it will succeed if foo is undefined, but not if foo is of zero length. test -z $foo works as expected (ie, it succeeds both when foo is undefined and when foo is of zero length), but it is a good idea to use test -z "$foo" and avoid the pathological case. (test -z $foo succeeds when foo is undefined because the string -z is non-empty.)
Jun
3
comment what is -z option in test command(linux)
There is a big difference between "zero length" and "not defined". STRING='' defines a string of length zero. The -z option to test does not distinguish between undefined or zero length.
Feb
27
comment Unix set path not working
Note that env_reset may or may not reset PATH, depending on how sudo was compiled.
Feb
27
comment Unix set path not working
When you invoke sudo, the PATH is not normally reset. However it is possible to set an option which resets it. Check if env_reset is set in the sudoers file.
Jan
31
comment Grant root privileges only for one directory
If you merely want a user to have full read/write/execute permission on /opt/myapp, then set the permissions that way. If you want something else, you will need to clarify.
Dec
11
comment What is the Unix PATH variable and how do I add to it?
In csh, you can run set PATH=/directory/to/add:$PATH:/low/priority/path. However, in the sh family (bash, ksh, zsh, etc), that does not set the variable PATH at all, but assigns to $1.
Dec
6
comment What is going wrong with cat
Does test1 have a newline at the end? If not, the output of cat will be a single line. Perhaps you can try: echo > newline; cat test1 newline test2 newline > output.
Nov
26
comment Copy files above 500kB from one directory to another in Ubuntu
Do you want to copy, move, or make a link? You probably want to either move or make a (hard) link. Copying is rarely necessary.
Nov
21
comment /usr/bin/mail equivalant for | sendmail -t
Is myfile an executable, or do you mean to do <myfile sendmail -t?
Nov
19
comment Prepend new vim buffer with 2 new lines
If merely adding blank lines, I would prefer romainl's suggestion: vim -c 'normal 2O' +3
Sep
17
comment Change install path to /usr/bin instead of /usr/local/bin
When you install via make install, you are not using a package management system, and it is not really appropriate to say that you are installing packages. You are installing unpackaged software.
Sep
13
comment What is effect of CTRL + Z on a unix\Linux application
^Z sends SIGTSTP, not SIGSTOP
Jun
6
comment in Linux, how to go to the folder above the symbolic link folder of the actual path?
This solution works, but only in certain settings. For example, in bash set -P will enable this, but set +P will cause it to fail. In either case, cd -P .. should work.
May
29
comment How can I set a git config item as a function?
@kopischke You are probably right and github.password is correct.
May
28
comment Send all error messages to a text file?
+1, but using '&>' to redirect both streams is arguably not valid shell syntax. dash for one will parse the & as a terminator so that ls &> foo becomes 2 commands: ls is run in the background and foo is truncated. It is not safe to use that construct. Personally, I believe the dash semantics are correct, but enough shells conflict with the language spec on this case that "ambiguous" is the only reasonable adjective to describe the parsing without triggering an unholy flame war. Avoid '&>'
Apr
27
comment How come cd doesn't work in my shell script?
It looks like $HOME is not set properly. As gpojd suggests, stop using the tilde.
Apr
27
comment Why is sudo bash needed?
Allowing 'sudo bash' for user X does not necessarily allow all users in the sudoers file to run bash.
Nov
25
comment Kill -9 doesn't kill process in Ubuntu
You cannot kill it because it is already dead. That's why it's called a zombie. ("defunct" is much less descriptive)