Searching

Another set of commands that will come in handy is the list and search commands. In the earlier chapter you would have seen me use the ls command to list the contents in a directory. There is another variation to this. If you need to see more details about the file then type ls -l and hit enter to show the contents in a long format with more details.

screenshot terminal2

 

If you need to search for a specific file one powerful command id locate FILE_NAME. FILE_NAME being the file being looked for. Below is a simple example of its use. Note that this command will search your entire file system.

terminas

 

Advertisements

Navigating the file system

Now that you have been through the introduction to shell scripting lets get to know more about navigating the file system.

To navigate the file system in the unix environment the main commands you will need are pwd(print working diretory), ls, cd(change directory)

Now lets see this in action.

Open your terminal and type pwd and hit the return button. The rerminal should return the path to current directory from which you are working. This is a quick way to know your current location.
user@ubuntu:~$ pwd

home/user

user@ubuntu:~$

Now lets move directories. But where do we go. A nice way to know that is to type ls and hit return. this command will list all directories and sub directories available in your current location. Now to move the the Documents directory type cd Documents and hit return. This will bring you to the Documents folder. You can enter ls to list all the contents of this folder.

If you want to get back to the previous folder enter cd .. and hit return.

This will bring you to the parent directory of Documents. Type pwd to check your current location.

Other shortcuts you can user are cd / this command takes you to your root directory and cd ~ will take you to your home directory.

The image below illustrates how these commands are used.

 

Screenshot terminal

 

Introduction to shell scripting

Shell scripting basically means writing commands that can be read my shell program for execution on a unix system . There are a number of shell programs like

  • Bash – Bourne Again Shell
  • Ksh – Kornshell
  • Zsh – Z shell

Each of these shell programs does the same job with differences in syntax and built in functionality, but for these series of blog posts i will focus on the Bash shell program.

In order to interact with a shell program using modern day Unix operating systems like Ubuntu Linux you will need a program called the terminal. on Ubuntu you can use the keyboard shortcut ctrl + alt + T  to open the terminal. Also note that if your Linux installation doesn’t have a (GUI) graphical user interface then you can interact with the shell using your already available command line interface.  If you have access to ny of these then you are ready to start shell scripting.

terminal
terminal

Shell scripting might sound a little intimidating for some but trust me its not difficult and it is a useful skill. I hope you enjoy the rest of the series.

 

Installing H265/HEVC Codecs on Ubuntu

I was about to watch a documentary this afternoon when I came across an error. It seems like the file wouldnt play no matter what media player I used. I run check on the format and it was an mkv file with a H265/HEVC format.

Never heard of that before? Yeah, me too.

According the Cnet, H265/HEVC (High Efficiency Video Coding) format is the new successor to Advanced Video Coding (AVC), also known as H.264, which is one of the compression schemes used by Blu-ray. The new successor to Advanced Video Coding (AVC), also known as H.264, which is one of the compression schemes used by Blu-ray.

codec

So how do you install the codecs on Ubuntu if your system doesn’t already have it? First you open your terminal (ctrl + Alt + T) and enter the following commands

sudo apt-add-repository ppa:strukturag/libde265
sudo apt-get update

This will add the needed repositories to allow you to install the codecs

sudo apt-get install gstreamer0.10-libde265
sudo apt-get install gstreamer1.0-libde265

 

And finally if you have VLC media player you can enter the following to add the necessary vlc plugins.

sudo apt-get install vlc-plugin-libde265

Now you can enjoy your movie. 🙂