Linux command `ls -lh` output - Week 8 : File Handling

Hello,

arr1=np.random.rand(1000,10)
arr2=np.random.rand(2000,5)
arr3=np.random.rand(20,10000)
np.savez("many_arrs",arr1,arr2,arr3)
!ls -lh

This code generates the following output:

total 1.8M
-rw-r--r-- 1 root root 1.7M Jun  5 11:17 many_arrs.npz
-rw-r--r-- 1 root root 1.6K Jun  5 10:50 planets_new.npy
-rw-r--r-- 1 root root 4.5K Jun  5 10:47 planets_new.txt
-rw-r--r-- 1 root root  257 Jun  5 10:18 planets_small.txt
-rw-r--r-- 1 root root 1.5K Jun  5 10:22 planets.txt
drwxr-xr-x 1 root root 4.0K May 29 18:19 sample_data

My questions are:

  1. What is the first column about?
  2. Since 4th column indicates file size, all the files have unit like Kb or Mb. But for planets_small.txt, why is it 257 only?

Thanks in advance.

  • First column tells about the read write permissions on the file for owner (which is you) and groups and others.
  • no units specified with 257, implies its 257 bytes. (K: Kilobytes, M: Megabytes)

To learn more about output of ‘ls’ you might find this link below helpful.

Hi @Mugdha,
These are the file access modes for various users, you can refer File permissions explained for a crisp and in depth explanation.
The file size is 257 Bytes

Yes :+1: … Understood it.
Thank you both @Ishvinder and @sanjayk.