Magic space on the current command line

2010-06-25 1 min read bash Fedora Linux
# For how to set up magic space for Bash see: # – http://www.ukuug.org/events/linux2003/papers/bash_tips/#slide15 # – http://codesnippets.joyent.com/posts/show/1690 man bash 2>/dev/null | less -p &#8217;magic-space&#8217; man bash 2>/dev/null | less -p &#8217;Event Designators&#8217; man bash 2>/dev/null | less -p &#8217;\!#&#8217; # &#8221;The entire <a class="zem_slink" title="Command-line interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Command-line_interface">command line typed so far.&#8221; <a href="http://snippets.dzone.com/posts/show/10265">Read more :<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.makeuseof.com/tag/trigger-wake-lan-mac-address/">How To Trigger Wake On LAN Using The MAC Address (makeuseof. Continue reading

Verify all the paths in the PATH directory

2010-06-08 1 min read bash Learning Linux
Here is the command to test that all the directories in your path actually exist. (<a class="zem_slink freebase/en/internal_field_separator" title="Internal field separator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Internal_field_separator">IFS=:;for p in $PATH; do test -d $p || echo $p; done) And the explanation : Set the IFS to &#8221;:&#8221; now we loop through the PATH variable and test all the directories with &#8221;test -d&#8221; Here is another version without IFS: for i in ${PATH//:/ };do test -d $i || echo $i;done Continue reading

Find out why a program can't seem to access to a file

2010-05-05 2 min read Fedora Linux
$ strace php tias.php -e open,access 2>&1 | <a class="zem_slink freebase/en/grep" href="http://en.wikipedia.org/wiki/Grep" title="Grep" rel="wikipedia">grep foo.txt Sometimes a program refuses to read a file and you&#8217;re not sure why. You may have display_errors turned off for <a class="zem_slink freebase/en/php" href="http://www.php.net/" title="PHP" rel="homepage">PHP or something. In this example, fopen(&#8217;/var/www/test/foo.txt&#8217;) was called but doesn&#8217;t have read access to foo.txt. Strace can tell you what went wrong. E.g., if php doesn&#8217;t have read access to the file, strace will say &#8221;EACCESS (Permission denied)&#8221;. Continue reading
Older posts Newer posts