Alright, so the other day I wanted to mess around with the ‘ls’ command in Linux, you know, the one that lists files in a directory. I had some time to kill and thought, why not dive deep into something I use almost every day but never really explored thoroughly?
I started by just typing ls in my terminal. Boom, there’s the usual list of files in my current directory. Nothing fancy, but it’s the starting point, right? Then, I remembered there are a bunch of options you can use with ‘ls’. So I tried ls -l. This gave me a long listing, showing stuff like permissions, number of links, owner, group, size, and modification time. Pretty neat, I must say.
But I didn’t stop there. I went on and tried ls -a. This one shows all files, including the hidden ones that start with a dot. It felt like discovering secret files on my own system! I saw things like ‘.bashrc’ and ‘.profile’ that I usually don’t pay attention to.
Next up, I combined a few options. I typed ls -al. Now, this was interesting. I got a detailed listing of all files, including the hidden ones. It felt like I was getting the full picture of what’s in my directory.
- And I can also use ls -la to get the same output!
I also played around with ls -lh. The ‘h’ here stands for “human-readable”. So, instead of seeing file sizes in bytes, I saw them in KB, MB, or GB, which is way easier to understand. For instance, a file that’s 1459820 bytes became a simple 1.4M. Much better!
Discovering hard links
I wanted to see all the names that refer to the same file on my system. I used the ls -samefile to find files that were hard links to a specific file. I thought this was pretty cool because it showed me how some files could have multiple names but are actually the same file.
I also learned about sorting. I used ls -lt to sort files by modification time, newest first. This is super handy when you want to see what’s been recently changed. And then there’s ls -ltr, which does the same but in reverse order, showing the oldest files first.
At one point, I got curious about directories. So, I used ls -d / to list only directories. It was a quick way to see all the folders without getting lost in the sea of files. Also, ls –help command shows me a help file for the ls command.

After hours of experimenting, I realized how much you can do with just a simple command like ‘ls’. It’s not just about listing files; it’s about understanding your file system, organizing things, and finding what you need quickly. I feel like I’ve leveled up my Linux skills just by digging into this one command. It’s been a fun and surprisingly educational ride, I gotta say!