Contents

[edit] Unix Commands

  • Full directory listing (long, hidden files, human readable sizes):
ls -lah


[edit] Redirects

  • Redirect output to /dev/null
commandhere > /dev/null 2>&1
  • Redirect all output to /dev/null and detatch the command. Good for running the mysql daemon inside a shell script without the script hanging. Note: If you want to run mysql commands after this, make sure you use the "pause" command to wait 5 seconds or so so that the daemon is actually up and running.
mysqld_safe --user=mysql < /dev/null > /dev/null 2> /dev/null &


  • Redirect all output to stdout:
commandhere 3>&2 2>&1

[edit] Other tips

[edit] Write a file

To write a file from inside a script. Example. Write a .htaccess file. The EOF represents the HEREDOC sytanx.

cat >> .htaccess << EOF
RemoveHandler .php
AddType application/my-httpd-php .php
Action application/my-httpd-php /~$USER/php.cgi
EOF