First Edition of 2-Bullet Tuesday: LED Traffic Light and the ls command

Hi everyone!

Welcome to 2-Bullet Tuesday, our new weekly newsletter where we’ll share useful tips and awesome stuff sent in by you, the users who made the Omega2 possible!


Favorite Project on Twitter:

LED traffic light project, sent to us by @PiBoyUK

What a great “Hello World” Python project for the Omega! See his post on Twitter.

Linux Command of the Week:

The venerable list directory command: ls
Running it plain with no arguments, ls, will provide a listing of the contents of the current working directory:

root@Omega-2A42:~# ls  
logo.bmp               qrCodeGen

To get additional info, let’s add the -l option to enable the long listing format. That will give us much for info on the contents of the directory:

root@Omega-2A42:~# ls -l
-rw-r--r--    1 root     root           443 Jan 20 15:38
-rw-r--r--    1 root     root       6815910 Dec  6 20:37 logo.bmp
-rw-r--r--    1 root     root          1005 Jan 20 15:48
drwxr-xr-x    2 root     root             0 Jan 16 19:41 qrCodeGen

Reading the columns from left to right gives us: the file type (directory, file, or link), the permissions, the owner, the owner’s Linux group, the size in bytes, date of last modification, and finally the name of the file.

Let’s get even more info by adding the -a option to show any hidden files and the -h option to print human readable file sizes:

root@Omega-2A42:~# ls -lah
drwxr-xr-x    1 root     root           0 Jan 24 21:02 .
drwxr-xr-x    1 root     root           0 Jan  1  1970 ..
drwxr-xr-x    3 root     root           0 Jan 20 14:52 .cache
-rw-r--r--    1 root     root         169 Jan 20 14:02 .wget-hsts
-rw-r--r--    1 root     root         443 Jan 20 15:38
-rw-r--r--    1 root     root        6.5M Dec  6 20:37 logo.bmp
-rw-r--r--    1 root     root        1005 Jan 20 15:48
drwxr-xr-x    2 root     root           0 Jan 16 19:41 qrCodeGen

If you need to quickly find the files that were changed most recently, try ls -ltr. The -t will sort the files by modification time and the -r will ensure that the most recently modified files show up at the bottom, making it easy to find that file you’re looking for really quickly.

root@Omega-2A42:~# ls -ltr
-rw-r--r--    1 root     root       6815910 Dec  6 20:37 logo.bmp
drwxr-xr-x    2 root     root             0 Jan 16 19:41 qrCodeGen
-rw-r--r--    1 root     root           443 Jan 20 15:38
-rw-r--r--    1 root     root          1005 Jan 24 21:04

See our Intro to Linux series for more command line skills!


Let us know what kind of stuff you would like to see featured on 2-Bullet Tuesday! Send a tweet to @OnionIoT with your suggestions!

Thanks for reading! Have a great week!

Team Onion



Lazar Demin

6 Customer comments “First Edition of 2-Bullet Tuesday: LED Traffic Light and the ls command

  • Sky

    24 Jan 2017 11:20 pm

    Just like to say that I love this idea! Looking forward to seeing a variety of ideas on the things people are doing and creative ways to make use of my Omega2.

  • Eva

    27 Jan 2017 2:15 pm

    Hey guys I m looking forward to buy one of the docks but all of them says out of stock. When will they be available? Thanks!

  • Faustino Beatrice

    27 Jan 2017 7:14 pm

    Love the Page. I want stickers 😀

  • Bob Green

    08 Feb 2017 4:09 am

    I like the 2 bullet Tuesday,really good idea, especially the Linux topics as they are very helpful. I have the Arduino dock, I would like to see an article covering that with the Arduino linked to external devices and communicating via mqtt and Node-Red.

Leave your comment