Here is a great little command line trick to list only the subdirectories in your current working directory. $ ls -d */
Author: Ryan
By default the echo command will include a trailing newline at the end of a string. There are many times when you may want to suppress this newline for example when you want to format text in a certain way.There are a couple easy ways to do this. First you can use the ‘-n’ option. $ echo -n “hello” You can also use the ‘-e’ option which enables interpretation of backslash escapes. Followed by a ‘\c’ escape character to signal continuation (no automatic line break). $ echo -e “hello\c”
The column utility is helpful for taking raw data and formatting it in a way that is easier for humans to comprehend. It can take a single column of data and format it into many equally spaced columns. Alternatively it can format multiple rows of data into tables. In our first example we have a numfile which contains 20 numbers, one on each line, which we output with cat. $ cat numfile1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 The output is long and you can quickly see…
With the new version of VirtualBox (4.0.0) comes a new feature called Extension Packs. Before version 4.0, there were two editions of VirtualBox: a full binary containing all features and an “Open Source Edition” (OSE) with source code. With version 4.0, there is only one version any more, which is open source, and the closed-source components have been moved to a separate extension pack. These will contain various additions like high-speed USB 2.0, Remote Display Services and Network booting. If you have the USB enabled when you update to version 4.0.0 and try to start the guest you will receive…
A handy feature about Google Chrome web browser besides its speed and simplicity is the ability to sync everything to your Google account between multiple browsers. Currently the features the support synchronization include apps, extensions, autofill, preferences, bookmarks, and themes. Other services like xmarks (previously Foxmarks) sync bookmarks but to have this feature supported natively in Chrome is a big plus. To setup sync simply navigate to the settings (tool icon) menu and select Prefences then Personal Stuff and click the Set up Sync. Then simply login with your Google account information and you are good to go. You can…
There are a couple ways to enable or disable system services at boot time in SUSE. From the command line: To enable a service: $ sudo insserv SERVICE To disable a service from starting: $ sudo insserv -r SERVICE You can also use YaST: YaST Control Center -> System -> System Services (runlevel) Select the service you want to change then click either the Enable or Disable button.
Most programs will return an exit status of 0 if the program was successful, while a non-zero exit status usually indicates an error. You can find the exit status or exit code of the previously executed command by accessing the “$?” shell variable. $ COMMAND $ echo $? Typically when a command terminates on a fatal signal whose number is N, Bash uses the value 128+N as the exit status. If a command is not found, the child process created to execute it returns a status of 127. If a command is found but is not executable, the return status…
For any number of reasons you may want to know the parent process ID of the current Bash script. You can find the parent process of the current Bash script or shell by printing the ‘$PPID’ shell variable. $ echo $PPID20341
In order to control or monitor background child processes from a shell script you will need to know the PID of the child. Bash stores the PID of the last process executed in the “$!” shell variable. If you start a background process in an interactive shell it will output the PID of the child. $ sleep 1 &[1]20450 Since thee PID of the last command set to run in the background by the current shell or script is stored in ‘$!’ variable, you can simply echo this variable to print the PID of the previous sleep command. $ echo…
In many cases you will need to determine the PID of a current Bash script or shell. Bash stores a specific variable that allows you to view the process ID of the current shell “$$’. You can echo the $$ to print the current PID. $ echo $$23490