Very interesting and strange bash trick with ls.

This is a very interesting bash trick I found using ls. This runs the ls command with random parameters. This is not very useful, but interesting nonetheless. 4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | tr -dc ‘hula’ | head –bytes 1`4.4 Tue Mar 03 jason@Yog-Sothoth 0:…

Read More

How to create a bash alias that can take arguments.

This bash alias will take a directory name or path as an argument. alias goto=’cd $1’alias goto=’cd $1′ This is an example of how this alias works. jason@jason-desktop:~$ goto /usr/share jason@jason-desktop:/usr/share$jason@jason-desktop:~$ goto /usr/share jason@jason-desktop:/usr/share$ This is a very neat bash trick. This might not work if the directory name uses…

Read More

Get the command line of a process without the ps command.

To get the command line of a process without the ps command, and the PID of the command is known, use this command. This example is using a process with a PID of 28633. ubuntu ~ $ cat /proc/28633/cmdline ; echo upstart-socket-bridge–daemonubuntu ~ $ cat /proc/28633/cmdline ; echo upstart-socket-bridge–daemon This…

Read More