Everyone knows the command
cd – everyone uses it several times a day. (OK – not everyone, but every Linux user.) Most of us know, that we can change back to the last directory with
$ cd -
$ cd /opt/sensors/bmp280
$ cd -
But what if you cd in your project directory and then need to change back into your docs directory? You have to type the whole path. Or do you?
Continue reading “Changing directories”
Several times a day I have to create a directory and have immediately change into this directory. After a while I found it rather annoying to type every time
$ mkdir new_directory
$ cd new_directory
So I created a shell function to reduce the typing:
mkdir -p "$@" && cd "$@"
Now I have to type only
$ mcd new_directory
and magically I’m in the newly created directory.
For different workflows I like to have directories with the actual date as name. To this end I created a little bash function called
mkdd (make date directory), which I put into my
This function creates the directory with the actual date in ISO format and changes into it:
Sometimes it is helpful to watch what a bash script is actual doing. This can be done with the parameter -x:
$ bash -x <script>
Continue reading “Watching a bash Script at Work”
$ bash -n <script>
Does not execute the script, checks the syntax.