LinkIt Smart Duo: Useful Linux commands (part 1)

The objective of this post is to list some useful Linux commands that can be sent on the LinkIt Smart operating system.


Introduction

The objective of this post is to list some useful commands that can be sent to the LinkIt Smart operating system, the OpenWrt. It includes some practical example use cases to test them in the device.

Most of these commands will be familiar to all who have worked with other distributions of the Linux Operating System.


List of commands

  • ls
  • pwd
  • cd
  • clear
  • uname


ls command

The ls (list) command lists the directory contents. So, it’s a very basic and usefully command that anyone working with Linux systems should know.

We will be seeing some examples using this command bellow. You can check the many command line options this command can take here.

 

pwd command

The pwd (print working directory) command prints the current directory where the user is located.

Figure 1 exemplifies the use of this command. First, I sent the command from the root directory (the default one when connecting via Putty) and then I moved to another directory using the cd command and issued the pwd,  which printed the new directory.

linkit-smart-pwd-command

Figure 1 – pwd command.


cd command

The cd (change directory) command is used to change the current directory [1].

Typing just the cd command will return us to the home directory [2]. In the case of the LinkIt Smart, we will return to the same directory we go when connecting via SSH using Putty.

If we type cd .. then we will move one directory up from where we are [2] or, in other words, we will change to the parent directory that contains the directory where we currently are.

From the current directory, if we type cd directoryName we will move to that directory, as long as it is contained in the current directory. This is called a relative path [2]. We can check child directories of the current directory using the ls command.

We can also navigate using the cd command and absolute paths. To to so, we just type cd /rootDirectory/someDirectory/anotherDirectory and the directory will be changed accordingly. An absolute path always starts with “/” [2].

To test these commands, just connect to the LinkIt Smart using Putty. From there, send the two following commands:

cd ..
ls

If you haven’t yet changed the folders of your LinkIt Smart, you should see something similar to figure 2.

linkit-smart-change-directory

Figure 2 – “/” directory of the LinkIt Smart.

In this case, let’s navigate to the IoT directory to check its contents. Just type the following:

cd IoT
ls

You should now see an examples folder inside this directory. Move to that folder and check its contents:

cd examples
ls

You should see 3 different files with sample code, as shown in figure 3.

Linkit Smart Examples folder.png

Figure 3 – Examples folder contents.

Now, to go back to the home directory, just type the cd command:

cd

After this command, you should be located in the same directory you were when established the connection to the LinkIt Smart. From there, you can simply go back to the examples directory using its absolute path:

cd /IoT/examples
ls

You can check some more cd command use cases here.

 

clear command

The clear command is a very useful command that cleans the contents of the screen [3].

To test the command, just type the following, with some content on you command line:

clear

You can check in figure 4 the command line before sending the clear command and after.

linkit-smart-clear

linkit-smart-after-clear-command

Figure 4 – clear command.


uname command

The uname command prints information about the current system [4]. The type of information printed will depend on the options passed to the command. A list of usefull options is shown bellow:

-n: Network node name

-s: Kernel name

-m: Machine hardware name

-p: Processor type

-o: Operating system

Figure 5 shows the result of running the uname command on the LinkIt Smart with the options listed. You can check more options for the command here. You can also use the -a option to print all the available information.

linkit-smart-uname-command

Figure 5 – uname command with multiple options.


Related content

 

References

[1] http://www.linfo.org/cd.html

[2] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/Step_by_Step_Guide/s1-navigating-cd.html

[3] https://www.tutorialspoint.com/unix_commands/clear.htm

[4] http://www.computerhope.com/unix/uuname.htm

Advertisements
This entry was posted in LinkIt Smart and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s