bubble(think so) sort in python programming language

# bubblesort attempted to be ported to python by
# Jeffrin Jose T <ahiliation@yahoo.co.in>
# from bubble.php by # detour@metalshell.com # License : GPL.

 

array_size = 20;

import random
result = []

# hash values of numbers between -5 to 256 are the same as the
# numbers themselves. So, whatever may be the order, set will have them
# in the sorted order. So, `result` cannot be a `set` here.

for x in range (0, 20):
    num = random.randint(0, 20)
    while num in result:
        num = random.randint(0, 40)
    result.append(num)
print result


for x in range (0,array_size):
    for y in range (0,array_size):
        if result[x] < result[y]:
            hold = result[x]
            result[x] = result[y]
            result[y] = hold


for x in range (0,array_size):
    print result[x]

How to write a shell script to find the greatest among three numbers ?

#!/bin/bash
#
# Linux Shell Scripting Tutorial 1.05r3, Summer-2002
#
# Written by Vivek G. Gite <vivek@nixcraft.com>
# modified by Jeffrin Jose T. <ahiliation@yahoo.co.in>
# Latest version can be found at http://www.nixcraft.com/
#
# Q2. Script to find out biggest number
#
# Algo:
# 1) START: Take three nos as n1,n2,n3.
# 2) Is n1 is greater than n2 and n3, if yes
# print n1 is bigest no goto step 5, otherwise goto next step
# 3) Is n2 is greater than n1 and n3, if yes
# print n2 is bigest no goto step 5, otherwise goto next step
# 4) Is n3 is greater than n1 and n2, if yes
# print n3 is bigest no goto step 5, otherwise goto next step
# 5) END
#
#

if [ $# -ne 3 ]
then
echo "$0: number1 number2 number3 are not given" >&2
exit 1
fi
n1=$1
n2=$2
n3=$3
if [ $n1 -gt $n2 ] && [ $n1 -gt $n3 ]
then
echo "$n1 is the Biggest number"
elif [ $n2 -gt $n1 ] && [ $n2 -gt $n3 ]
then
echo "$n2 is the Biggest number"
elif [ $n3 -gt $n1 ] && [ $n3 -gt $n2 ]
then
echo "$n3 is the Biggest number"
elif [ $1 -eq $2 ] && [ $1 -eq $3 ] && [ $2 -eq $3 ]
then
echo "All the three numbers are equal"
else
echo "I can not figure out which number is bigger"
fi

#
# ./ch.sh: vivek-tech.com to nixcraft.com referance converted using this tool
# See the tool at http://www.nixcraft.com/uniqlinuxfeatures/tools/
#

pr – convert text files for printing

The following shows a command line session with pr 
command which helps in displaying contents of a file
in shell scripts.

$cat lkg.txt 
A for Apple
B for Ball
C for Cat
D for Donkey
E for Elephant
F for Fox
G for Goat
H for Horse
I for Insect
$pr -l 10 lkg.txt 
A for Apple
B for Ball
C for Cat
D for Donkey
E for Elephant
F for Fox
G for Goat
H for Horse
I for Insect
$

chattr practice session . I

The following shows a command line session with chattr 
command which helps in changing attributes of files.

$lsattr functions.txt
-------------e-- functions.txt
$chattr -e functions.txt
chattr: Clearing extent flag not supported on functions.txt
$lsattr functions.txt
-------------e-- functions.txt
$chattr +c functions.txt
$lsattr functions.txt
--------c----e-- functions.txt
$lsattr functions.txt
--------c----e-- functions.txt
$chattr +a functions.txt
chattr: Operation not permitted while setting flags on functions.txt
$chattr +C functions.txt
$lsattr functions.txt
--------c----e-- functions.txt
$

The 'e' attribute indicates that the file is using
extents for mapping the blocks on  disk.

A file with the `c' attribute set is automatically 
compressed on the disk by the kernel.

A file with the `a' attribute set can only be open 
in append mode for writing.

A  file  with  the 'C' attribute set will not be subject
to copy-on-write updates.

Looking into a lsattr practice session .

ABOUT lsattr

The following shows a command line session with lsattr command which helps in listing file attributes.

[bash]
$pwd
/proc
$lsattr
lsattr: Inappropriate ioctl for device While reading flags on ./asound
lsattr: Permission denied While reading flags on ./sysrq-trigger
lsattr: Inappropriate ioctl for device While reading flags on ./partitions
lsattr: Inappropriate ioctl for device While reading flags on ./diskstats
lsattr: Inappropriate ioctl for device While reading flags on ./crypto
lsattr: Inappropriate ioctl for device While reading flags on ./key-users
lsattr: Inappropriate ioctl for device While reading flags on ./keys
lsattr: Permission denied While reading flags on ./kpageflags
lsattr: Permission denied While reading flags on ./kpagecount
lsattr: Permission denied While reading flags on ./kmsg
lsattr: Permission denied While reading flags on ./kcore
lsattr: Inappropriate ioctl for device While reading flags on ./softirqs
lsattr: Inappropriate ioctl for device While reading flags on ./version
lsattr: Inappropriate ioctl for device While reading flags on ./uptime
lsattr: Inappropriate ioctl for device While reading flags on ./stat
lsattr: Inappropriate ioctl for device While reading flags on ./meminfo
lsattr: Inappropriate ioctl for device While reading flags on ./loadavg
lsattr: Inappropriate ioctl for device While reading flags on ./interrupts
lsattr: Inappropriate ioctl for device While reading flags on ./devices
lsattr: Inappropriate ioctl for device While reading flags on ./cpuinfo
lsattr: Inappropriate ioctl for device While reading flags on ./consoles
lsattr: Inappropriate ioctl for device While reading flags on ./cmdline
lsattr: Inappropriate ioctl for device While reading flags on ./locks
lsattr: Inappropriate ioctl for device While reading flags on ./filesystems
lsattr: Inappropriate ioctl for device While reading flags on ./swaps
lsattr: Permission denied While reading flags on ./vmallocinfo
lsattr: Permission denied While reading flags on ./slabinfo
lsattr: Inappropriate ioctl for device While reading flags on ./zoneinfo
lsattr: Inappropriate ioctl for device While reading flags on ./vmstat
lsattr: Inappropriate ioctl for device While reading flags on ./pagetypeinfo
lsattr: Inappropriate ioctl for device While reading flags on ./buddyinfo
lsattr: Inappropriate ioctl for device While reading flags on ./kallsyms
lsattr: Inappropriate ioctl for device While reading flags on ./modules
lsattr: Inappropriate ioctl for device While reading flags on ./dma
lsattr: Inappropriate ioctl for device While reading flags on ./timer_stats
lsattr: Inappropriate ioctl for device While reading flags on ./timer_list
lsattr: Inappropriate ioctl for device While reading flags on ./sched_debug
lsattr: Inappropriate ioctl for device While reading flags on ./iomem
lsattr: Inappropriate ioctl for device While reading flags on ./ioports
lsattr: Inappropriate ioctl for device While reading flags on ./execdomains
lsattr: Inappropriate ioctl for device While reading flags on ./misc
lsattr: Inappropriate ioctl for device While reading flags on ./acpi
lsattr: Inappropriate ioctl for device While reading flags on ./fb
lsattr: Inappropriate ioctl for device While reading flags on ./mtrr
lsattr: Inappropriate ioctl for device While reading flags on ./irq
lsattr: Inappropriate ioctl for device While reading flags on ./cgroups
lsattr: Inappropriate ioctl for device While reading flags on ./sys
lsattr: Inappropriate ioctl for device While reading flags on ./bus
lsattr: Inappropriate ioctl for device While reading flags on ./tty
lsattr: Inappropriate ioctl for device While reading flags on ./driver
lsattr: Inappropriate ioctl for device While reading flags on ./fs
lsattr: Inappropriate ioctl for device While reading flags on ./sysvipc
lsattr: Operation not supported While reading flags on ./net
lsattr: Operation not supported While reading flags on ./mounts
lsattr: Operation not supported While reading flags on ./self
lsattr: Inappropriate ioctl for device While reading flags on ./1
lsattr: Inappropriate ioctl for device While reading flags on ./2
lsattr: Inappropriate ioctl for device While reading flags on ./3
lsattr: Inappropriate ioctl for device While reading flags on ./5
lsattr: Inappropriate ioctl for device While reading flags on ./7
lsattr: Inappropriate ioctl for device While reading flags on ./8
lsattr: Inappropriate ioctl for device While reading flags on ./9
lsattr: Inappropriate ioctl for device While reading flags on ./10
lsattr: Inappropriate ioctl for device While reading flags on ./11
lsattr: Inappropriate ioctl for device While reading flags on ./12
lsattr: Inappropriate ioctl for device While reading flags on ./13
lsattr: Inappropriate ioctl for device While reading flags on ./15
lsattr: Inappropriate ioctl for device While reading flags on ./16
lsattr: Inappropriate ioctl for device While reading flags on ./17
lsattr: Inappropriate ioctl for device While reading flags on ./18
lsattr: Inappropriate ioctl for device While reading flags on ./19
lsattr: Inappropriate ioctl for device While reading flags on ./20
lsattr: Inappropriate ioctl for device While reading flags on ./21
lsattr: Inappropriate ioctl for device While reading flags on ./22
lsattr: Inappropriate ioctl for device While reading flags on ./23
lsattr: Inappropriate ioctl for device While reading flags on ./24
lsattr: Inappropriate ioctl for device While reading flags on ./25
lsattr: Inappropriate ioctl for device While reading flags on ./26
lsattr: Inappropriate ioctl for device While reading flags on ./27
lsattr: Inappropriate ioctl for device While reading flags on ./28
lsattr: Inappropriate ioctl for device While reading flags on ./29
lsattr: Inappropriate ioctl for device While reading flags on ./30
lsattr: Inappropriate ioctl for device While reading flags on ./35
lsattr: Inappropriate ioctl for device While reading flags on ./36
lsattr: Inappropriate ioctl for device While reading flags on ./77
lsattr: Inappropriate ioctl for device While reading flags on ./88
lsattr: Inappropriate ioctl for device While reading flags on ./135
lsattr: Inappropriate ioctl for device While reading flags on ./136
lsattr: Inappropriate ioctl for device While reading flags on ./137
lsattr: Inappropriate ioctl for device While reading flags on ./139
lsattr: Inappropriate ioctl for device While reading flags on ./140
lsattr: Inappropriate ioctl for device While reading flags on ./141
lsattr: Inappropriate ioctl for device While reading flags on ./144
lsattr: Inappropriate ioctl for device While reading flags on ./145
lsattr: Inappropriate ioctl for device While reading flags on ./151
lsattr: Inappropriate ioctl for device While reading flags on ./165
lsattr: Inappropriate ioctl for device While reading flags on ./166
lsattr: Inappropriate ioctl for device While reading flags on ./189
lsattr: Inappropriate ioctl for device While reading flags on ./190
lsattr: Inappropriate ioctl for device While reading flags on ./337
lsattr: Inappropriate ioctl for device While reading flags on ./451
lsattr: Inappropriate ioctl for device While reading flags on ./453
lsattr: Inappropriate ioctl for device While reading flags on ./477
lsattr: Inappropriate ioctl for device While reading flags on ./485
lsattr: Inappropriate ioctl for device While reading flags on ./544
lsattr: Inappropriate ioctl for device While reading flags on ./1214
lsattr: Inappropriate ioctl for device While reading flags on ./2027
lsattr: Inappropriate ioctl for device While reading flags on ./2068
lsattr: Inappropriate ioctl for device While reading flags on ./2097
lsattr: Inappropriate ioctl for device While reading flags on ./2152
lsattr: Inappropriate ioctl for device While reading flags on ./2399
lsattr: Inappropriate ioctl for device While reading flags on ./2427
lsattr: Inappropriate ioctl for device While reading flags on ./2469
lsattr: Inappropriate ioctl for device While reading flags on ./2508
lsattr: Inappropriate ioctl for device While reading flags on ./2526
lsattr: Inappropriate ioctl for device While reading flags on ./2586
lsattr: Inappropriate ioctl for device While reading flags on ./2599
lsattr: Inappropriate ioctl for device While reading flags on ./2600
lsattr: Inappropriate ioctl for device While reading flags on ./2613
lsattr: Inappropriate ioctl for device While reading flags on ./2651
lsattr: Inappropriate ioctl for device While reading flags on ./2663
lsattr: Inappropriate ioctl for device While reading flags on ./2686
lsattr: Inappropriate ioctl for device While reading flags on ./2729
lsattr: Inappropriate ioctl for device While reading flags on ./2743
lsattr: Inappropriate ioctl for device While reading flags on ./2772
lsattr: Inappropriate ioctl for device While reading flags on ./2777
lsattr: Inappropriate ioctl for device While reading flags on ./2779
lsattr: Inappropriate ioctl for device While reading flags on ./2784
lsattr: Inappropriate ioctl for device While reading flags on ./2898
lsattr: Inappropriate ioctl for device While reading flags on ./2901
lsattr: Inappropriate ioctl for device While reading flags on ./2969
lsattr: Inappropriate ioctl for device While reading flags on ./2984
lsattr: Inappropriate ioctl for device While reading flags on ./2985
lsattr: Inappropriate ioctl for device While reading flags on ./3019
lsattr: Inappropriate ioctl for device While reading flags on ./3023
lsattr: Inappropriate ioctl for device While reading flags on ./3047
lsattr: Inappropriate ioctl for device While reading flags on ./3048
lsattr: Inappropriate ioctl for device While reading flags on ./3049
lsattr: Inappropriate ioctl for device While reading flags on ./3050
lsattr: Inappropriate ioctl for device While reading flags on ./3051
lsattr: Inappropriate ioctl for device While reading flags on ./3052
lsattr: Inappropriate ioctl for device While reading flags on ./3054
lsattr: Inappropriate ioctl for device While reading flags on ./3072
lsattr: Inappropriate ioctl for device While reading flags on ./3075
lsattr: Inappropriate ioctl for device While reading flags on ./3076
lsattr: Inappropriate ioctl for device While reading flags on ./3079
lsattr: Inappropriate ioctl for device While reading flags on ./3083
lsattr: Inappropriate ioctl for device While reading flags on ./3086
lsattr: Inappropriate ioctl for device While reading flags on ./3100
lsattr: Inappropriate ioctl for device While reading flags on ./3107
lsattr: Inappropriate ioctl for device While reading flags on ./3109
lsattr: Inappropriate ioctl for device While reading flags on ./3116
lsattr: Inappropriate ioctl for device While reading flags on ./3117
lsattr: Inappropriate ioctl for device While reading flags on ./3128
lsattr: Inappropriate ioctl for device While reading flags on ./3284
lsattr: Inappropriate ioctl for device While reading flags on ./3288
lsattr: Inappropriate ioctl for device While reading flags on ./3297
lsattr: Inappropriate ioctl for device While reading flags on ./3302
lsattr: Inappropriate ioctl for device While reading flags on ./3306
lsattr: Inappropriate ioctl for device While reading flags on ./3309
lsattr: Inappropriate ioctl for device While reading flags on ./3315
lsattr: Inappropriate ioctl for device While reading flags on ./3318
lsattr: Inappropriate ioctl for device While reading flags on ./3321
lsattr: Inappropriate ioctl for device While reading flags on ./3328
lsattr: Inappropriate ioctl for device While reading flags on ./3332
lsattr: Inappropriate ioctl for device While reading flags on ./3358
lsattr: Inappropriate ioctl for device While reading flags on ./3362
lsattr: Inappropriate ioctl for device While reading flags on ./3368
lsattr: Inappropriate ioctl for device While reading flags on ./3379
lsattr: Inappropriate ioctl for device While reading flags on ./3391
lsattr: Inappropriate ioctl for device While reading flags on ./3396
lsattr: Inappropriate ioctl for device While reading flags on ./3397
lsattr: Inappropriate ioctl for device While reading flags on ./3410
lsattr: Inappropriate ioctl for device While reading flags on ./3424
lsattr: Inappropriate ioctl for device While reading flags on ./3448
lsattr: Inappropriate ioctl for device While reading flags on ./3515
lsattr: Inappropriate ioctl for device While reading flags on ./3570
lsattr: Inappropriate ioctl for device While reading flags on ./3576
lsattr: Inappropriate ioctl for device While reading flags on ./3577
lsattr: Inappropriate ioctl for device While reading flags on ./3578
lsattr: Inappropriate ioctl for device While reading flags on ./3584
lsattr: Inappropriate ioctl for device While reading flags on ./3585
lsattr: Inappropriate ioctl for device While reading flags on ./3627
lsattr: Inappropriate ioctl for device While reading flags on ./3706
lsattr: Inappropriate ioctl for device While reading flags on ./3727
lsattr: Inappropriate ioctl for device While reading flags on ./3782
lsattr: Inappropriate ioctl for device While reading flags on ./3904
lsattr: Inappropriate ioctl for device While reading flags on ./3907
lsattr: Inappropriate ioctl for device While reading flags on ./3908
lsattr: Inappropriate ioctl for device While reading flags on ./4036
lsattr: Inappropriate ioctl for device While reading flags on ./4057
lsattr: Inappropriate ioctl for device While reading flags on ./4113
[/bash]
[bash]
$mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=427906,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=343916k,mode=755)
/dev/disk/by-uuid/3219e911-81fb-4d52-ba7c-117a58d09312 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=745780k)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/cgroup type tmpfs (rw,relatime,size=4k,mode=755)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,name=systemd)
[/bash]
[bash]
$cd /sys/
$lsattr
lsattr: Inappropriate ioctl for device While reading flags on ./fs
lsattr: Inappropriate ioctl for device While reading flags on ./bus
lsattr: Inappropriate ioctl for device While reading flags on ./dev
lsattr: Inappropriate ioctl for device While reading flags on ./devices
lsattr: Inappropriate ioctl for device While reading flags on ./block
lsattr: Inappropriate ioctl for device While reading flags on ./class
lsattr: Inappropriate ioctl for device While reading flags on ./power
lsattr: Inappropriate ioctl for device While reading flags on ./firmware
lsattr: Inappropriate ioctl for device While reading flags on ./kernel
lsattr: Inappropriate ioctl for device While reading flags on ./module
lsattr: Inappropriate ioctl for device While reading flags on ./hypervisor
$pwd
/sys
[/bash]
[bash]
$cd /run/
$lsattr
lsattr: Permission denied While reading flags on ./udisks2
lsattr: Inappropriate ioctl for device While reading flags on ./pm-utils
lsattr: Permission denied While reading flags on ./wpa_supplicant
lsattr: Inappropriate ioctl for device While reading flags on ./sshd.pid
lsattr: Inappropriate ioctl for device While reading flags on ./minissdpd.pid
lsattr: Operation not supported While reading flags on ./minissdpd.sock
lsattr: Inappropriate ioctl for device While reading flags on ./console
lsattr: Inappropriate ioctl for device While reading flags on ./user
lsattr: Inappropriate ioctl for device While reading flags on ./systemd
lsattr: Inappropriate ioctl for device While reading flags on ./console-kit-daemon.pid
lsattr: Inappropriate ioctl for device While reading flags on ./ConsoleKit
lsattr: Inappropriate ioctl for device While reading flags on ./gdm3.pid
lsattr: Permission denied While reading flags on ./gdm3
lsattr: Inappropriate ioctl for device While reading flags on ./sshd
lsattr: Inappropriate ioctl for device While reading flags on ./NetworkManager
lsattr: Operation not supported While reading flags on ./sdp
lsattr: Inappropriate ioctl for device While reading flags on ./ntpd.pid
lsattr: Inappropriate ioctl for device While reading flags on ./avahi-daemon
lsattr: Inappropriate ioctl for device While reading flags on ./dhclient.eth0.pid
lsattr: Permission denied While reading flags on ./crond.reboot
lsattr: Inappropriate ioctl for device While reading flags on ./crond.pid
lsattr: Permission denied While reading flags on ./exim4
lsattr: Inappropriate ioctl for device While reading flags on ./nscd
lsattr: Inappropriate ioctl for device While reading flags on ./gpm.pid
lsattr: Inappropriate ioctl for device While reading flags on ./gdomap.pid
lsattr: Inappropriate ioctl for device While reading flags on ./acpid.pid
lsattr: Operation not supported While reading flags on ./acpid.socket
lsattr: Inappropriate ioctl for device While reading flags on ./dbus
lsattr: Inappropriate ioctl for device While reading flags on ./atd.pid
lsattr: Inappropriate ioctl for device While reading flags on ./rsyslogd.pid
lsattr: Inappropriate ioctl for device While reading flags on ./motd.dynamic
lsattr: Inappropriate ioctl for device While reading flags on ./network
lsattr: Inappropriate ioctl for device While reading flags on ./shm
lsattr: Inappropriate ioctl for device While reading flags on ./mount
lsattr: Inappropriate ioctl for device While reading flags on ./lock
lsattr: Inappropriate ioctl for device While reading flags on ./sendsigs.omit.d
lsattr: Operation not supported While reading flags on ./initctl
lsattr: Inappropriate ioctl for device While reading flags on ./utmp
lsattr: Inappropriate ioctl for device While reading flags on ./udev
lsattr: Inappropriate ioctl for device While reading flags on ./initramfs
[/bash]
[bash]
$cd /dev/
$lsattr
lsattr: Operation not supported While reading flags on ./vcsa7
lsattr: Operation not supported While reading flags on ./vcs7
lsattr: Operation not supported While reading flags on ./gpmctl
lsattr: Operation not supported While reading flags on ./log
lsattr: Operation not supported While reading flags on ./xconsole
lsattr: Operation not supported While reading flags on ./fb0
lsattr: Inappropriate ioctl for device While reading flags on ./dri
lsattr: Operation not supported While reading flags on ./loop7
lsattr: Operation not supported While reading flags on ./loop6
lsattr: Operation not supported While reading flags on ./loop5
lsattr: Operation not supported While reading flags on ./loop4
lsattr: Operation not supported While reading flags on ./loop3
lsattr: Operation not supported While reading flags on ./loop2
lsattr: Operation not supported While reading flags on ./loop1
lsattr: Operation not supported While reading flags on ./shm
lsattr: Operation not supported While reading flags on ./vcsa6
lsattr: Operation not supported While reading flags on ./vcs6
lsattr: Operation not supported While reading flags on ./vcsa5
lsattr: Operation not supported While reading flags on ./vcs5
lsattr: Operation not supported While reading flags on ./vcsa4
lsattr: Operation not supported While reading flags on ./vcs4
lsattr: Operation not supported While reading flags on ./vcsa3
lsattr: Operation not supported While reading flags on ./vcs3
lsattr: Operation not supported While reading flags on ./vcsa2
lsattr: Operation not supported While reading flags on ./vcs2
lsattr: Operation not supported While reading flags on ./kvm
lsattr: Operation not supported While reading flags on ./sndstat
lsattr: Operation not supported While reading flags on ./cdrom
lsattr: Operation not supported While reading flags on ./rfkill
lsattr: Operation not supported While reading flags on ./MAKEDEV
lsattr: Inappropriate ioctl for device While reading flags on ./snd
lsattr: Operation not supported While reading flags on ./vhost-net
lsattr: Operation not supported While reading flags on ./uinput
lsattr: Operation not supported While reading flags on ./autofs
lsattr: Inappropriate ioctl for device While reading flags on ./net
lsattr: Operation not supported While reading flags on ./loop0
lsattr: Operation not supported While reading flags on ./hidraw1
lsattr: Inappropriate ioctl for device While reading flags on ./usb
lsattr: Operation not supported While reading flags on ./hidraw0
lsattr: Operation not supported While reading flags on ./sda6
lsattr: Operation not supported While reading flags on ./sda5
lsattr: Operation not supported While reading flags on ./sda2
lsattr: Operation not supported While reading flags on ./sda1
lsattr: Inappropriate ioctl for device While reading flags on ./disk
lsattr: Inappropriate ioctl for device While reading flags on ./block
lsattr: Operation not supported While reading flags on ./sg1
lsattr: Operation not supported While reading flags on ./sg0
lsattr: Operation not supported While reading flags on ./sr0
lsattr: Operation not supported While reading flags on ./sda
lsattr: Inappropriate ioctl for device While reading flags on ./bsg
lsattr: Inappropriate ioctl for device While reading flags on ./bus
lsattr: Operation not supported While reading flags on ./rtc
lsattr: Inappropriate ioctl for device While reading flags on ./char
lsattr: Operation not supported While reading flags on ./uhid
lsattr: Inappropriate ioctl for device While reading flags on ./mapper
lsattr: Operation not supported While reading flags on ./ppp
lsattr: Operation not supported While reading flags on ./loop-control
lsattr: Operation not supported While reading flags on ./btrfs-control
lsattr: Operation not supported While reading flags on ./fuse
lsattr: Operation not supported While reading flags on ./stderr
lsattr: Operation not supported While reading flags on ./stdout
lsattr: Operation not supported While reading flags on ./stdin
lsattr: Operation not supported While reading flags on ./fd
lsattr: Operation not supported While reading flags on ./core
lsattr: Inappropriate ioctl for device While reading flags on ./pts
lsattr: Operation not supported While reading flags on ./network_throughput
lsattr: Operation not supported While reading flags on ./network_latency
lsattr: Operation not supported While reading flags on ./cpu_dma_latency
lsattr: Operation not supported While reading flags on ./mcelog
lsattr: Operation not supported While reading flags on ./rtc0
lsattr: Operation not supported While reading flags on ./psaux
lsattr: Inappropriate ioctl for device While reading flags on ./input
lsattr: Operation not supported While reading flags on ./hpet
lsattr: Operation not supported While reading flags on ./ttyS3
lsattr: Operation not supported While reading flags on ./ttyS2
lsattr: Operation not supported While reading flags on ./ttyS1
lsattr: Operation not supported While reading flags on ./ttyS0
lsattr: Operation not supported While reading flags on ./ptmx
lsattr: Operation not supported While reading flags on ./snapshot
lsattr: Inappropriate ioctl for device While reading flags on ./cpu
lsattr: Operation not supported While reading flags on ./tty63
lsattr: Operation not supported While reading flags on ./tty62
lsattr: Operation not supported While reading flags on ./tty61
lsattr: Operation not supported While reading flags on ./tty60
lsattr: Operation not supported While reading flags on ./tty59
lsattr: Operation not supported While reading flags on ./tty58
lsattr: Operation not supported While reading flags on ./tty57
lsattr: Operation not supported While reading flags on ./tty56
lsattr: Operation not supported While reading flags on ./tty55
lsattr: Operation not supported While reading flags on ./tty54
lsattr: Operation not supported While reading flags on ./tty53
lsattr: Operation not supported While reading flags on ./tty52
lsattr: Operation not supported While reading flags on ./tty51
lsattr: Operation not supported While reading flags on ./tty50
lsattr: Operation not supported While reading flags on ./tty49
lsattr: Operation not supported While reading flags on ./tty48
lsattr: Operation not supported While reading flags on ./tty47
lsattr: Operation not supported While reading flags on ./tty46
lsattr: Operation not supported While reading flags on ./tty45
lsattr: Operation not supported While reading flags on ./tty44
lsattr: Operation not supported While reading flags on ./tty43
lsattr: Operation not supported While reading flags on ./tty42
lsattr: Operation not supported While reading flags on ./tty41
lsattr: Operation not supported While reading flags on ./tty40
lsattr: Operation not supported While reading flags on ./tty39
lsattr: Operation not supported While reading flags on ./tty38
lsattr: Operation not supported While reading flags on ./tty37
lsattr: Operation not supported While reading flags on ./tty36
lsattr: Operation not supported While reading flags on ./tty35
lsattr: Operation not supported While reading flags on ./tty34
lsattr: Operation not supported While reading flags on ./tty33
lsattr: Operation not supported While reading flags on ./tty32
lsattr: Operation not supported While reading flags on ./tty31
lsattr: Operation not supported While reading flags on ./tty30
lsattr: Operation not supported While reading flags on ./tty29
lsattr: Operation not supported While reading flags on ./tty28
lsattr: Operation not supported While reading flags on ./tty27
lsattr: Operation not supported While reading flags on ./tty26
lsattr: Operation not supported While reading flags on ./tty25
lsattr: Operation not supported While reading flags on ./tty24
lsattr: Operation not supported While reading flags on ./tty23
lsattr: Operation not supported While reading flags on ./tty22
lsattr: Operation not supported While reading flags on ./tty21
lsattr: Operation not supported While reading flags on ./tty20
lsattr: Operation not supported While reading flags on ./tty19
lsattr: Operation not supported While reading flags on ./tty18
lsattr: Operation not supported While reading flags on ./tty17
lsattr: Operation not supported While reading flags on ./tty16
lsattr: Operation not supported While reading flags on ./tty15
lsattr: Operation not supported While reading flags on ./tty14
lsattr: Operation not supported While reading flags on ./tty13
lsattr: Operation not supported While reading flags on ./tty12
lsattr: Operation not supported While reading flags on ./tty11
lsattr: Operation not supported While reading flags on ./tty10
lsattr: Operation not supported While reading flags on ./tty9
lsattr: Operation not supported While reading flags on ./tty8
lsattr: Operation not supported While reading flags on ./tty7
lsattr: Operation not supported While reading flags on ./tty6
lsattr: Operation not supported While reading flags on ./tty5
lsattr: Operation not supported While reading flags on ./tty4
lsattr: Operation not supported While reading flags on ./tty3
lsattr: Operation not supported While reading flags on ./tty2
lsattr: Operation not supported While reading flags on ./tty1
lsattr: Operation not supported While reading flags on ./vcsa1
lsattr: Operation not supported While reading flags on ./vcs1
lsattr: Operation not supported While reading flags on ./vcsa
lsattr: Operation not supported While reading flags on ./vcs
lsattr: Operation not supported While reading flags on ./tty0
lsattr: Operation not supported While reading flags on ./console
lsattr: Operation not supported While reading flags on ./tty
lsattr: Operation not supported While reading flags on ./kmsg
lsattr: Operation not supported While reading flags on ./urandom
lsattr: Operation not supported While reading flags on ./random
lsattr: Operation not supported While reading flags on ./full
lsattr: Operation not supported While reading flags on ./zero
lsattr: Operation not supported While reading flags on ./port
lsattr: Operation not supported While reading flags on ./null
lsattr: Operation not supported While reading flags on ./mem
lsattr: Operation not supported While reading flags on ./vga_arbiter
$
[/bash]

LINKS
https://bbs.archlinux.org/viewtopic.php?id=63293
https://www.howtoforge.com/linux-lsattr-command/
https://www.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.cmds3/lsattr.htm

lsattr practice session . IV

The following shows a command line session with lsattr 
command which helps in listing file attributes.
root>(time lsattr ) &>> lsattr-with-time.txt
root>cat lsattr-with-time.txt 
lsattr: Inappropriate ioctl for device While reading flags on ./sys
lsattr: Inappropriate ioctl for device While reading flags on ./dev
lsattr: Operation not supported While reading flags on ./initrd.img
lsattr: Inappropriate ioctl for device While reading flags on ./run
lsattr: Inappropriate ioctl for device While reading flags on ./proc
lsattr: Operation not supported While reading flags on ./vmlinuz
-------------e-- ./libx32
-------------e-- ./media
-------------e-- ./tmp
-------------e-- ./var
-------------e-- ./lsattr-with-time.txt
----------I--e-- ./etc
-------------e-- ./bin
-------------e-- ./boot
-------------e-- ./root
-------------e-- ./lib64
-------------e-- ./opt
-------------e-- ./build
-------------e-- ./selinux
-------------e-- ./mnt
-------------e-- ./lost+found
-------------e-- ./usr
-------------e-- ./lib
-------------e-- ./srv
-------------e-- ./home
----------I--e-- ./sbin

real	0m0.062s
user	0m0.000s
sys	0m0.000s
root>



The  'I'  attribute  is  used  by  the htree code to indicate that a directory is being indexed using hashed trees.  It may not be set or reset using chattr, although it can be displayed by lsattr.


The 'e' attribute indicates that the file is using extents for mapping the blocks on  disk.

lsattr practice session . III

The following shows a command line session with lsattr 
command which helps in listing file attributes.
$lsattr 
-------------e-- ./(2561).jpg
-------------e-- ./(1596).jpg
-------------e-- ./(2551).jpg
-------------e-- ./(2157).jpg
-------------e-- ./(2053).jpg
-------------e-- ./(1793).jpg
-------------e-- ./(1917).jpg
-------------e-- ./shortlisted
-------------e-- ./(1722).jpg
-------------e-- ./(1881).jpg
-------------e-- ./(1654).jpg
$lsattr /home/jeffrin/.bash_history 
-------------e-- /home/jeffrin/.bash_history
$lsattr /home/jeffrin/.gnome2
-------------e-- /home/jeffrin/.gnome2/keyrings
-------------e-- /home/jeffrin/.gnome2/accels
$lsattr /home/jeffrin/.m
.mission-control/ .mplayer/         .muttrc           .muttrc-personal  
.mozilla/         .muttdebug0       .muttrc~          
$lsattr /home/jeffrin/.mozilla/
-------------e-- /home/jeffrin/.mozilla/firefox
-------------e-- /home/jeffrin/.mozilla/extensions
$lsattr /home/jeffrin/.muttrc
-------------e-- /home/jeffrin/.muttrc
$lsattr /home/jeffrin/.mission-control/
-------------e-- /home/jeffrin/.mission-control/accounts
$lsattr /home/jeffrin/beautifulwork.org-git/
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork
$lsattr /home/jeffrin/beautifulwork.org-git/beautifulwork/
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-includes
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-blog-header.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/perl-testing.pl
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-admin
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-trackback.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/README.md
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/index.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-cron.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-links-opml.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-comments-post.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-load.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/Mail
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-activate.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-signup.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-login.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/xmlrpc.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-config-sample.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-mail.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/beautifulwork-charts.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-settings.php
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/wp-content
-------------e-- /home/jeffrin/beautifulwork.org-git/beautifulwork/readme.html
$

The 'e' attribute indicates that the file is using extents for mapping the blocks on  disk.   It  may not be removed using chattr.

lsattr graph . I

The following  graph shows the time details to execute lsattr 
command which helps in listing file attributes.

The following shows a commandline session related to the
output of time command along with lsattr.The values for
plotting the above graph is taken from the following 
readings.

-------------e-- ./README.md
-------------e-- ./lsattr.txt
-------------e-- ./barplot

real	0m0.002s
user	0m0.000s
sys	0m0.000s
-------------e-- ./README.md
-------------e-- ./lsattr.txt
-------------e-- ./barplot

real	0m0.002s
user	0m0.000s
sys	0m0.000s
-------------e-- ./README.md
-------------e-- ./lsattr.txt
-------------e-- ./barplot

real	0m0.002s
user	0m0.000s
sys	0m0.000s
-------------e-- ./README.md
-------------e-- ./lsattr.txt
-------------e-- ./barplot

real	0m0.002s
user	0m0.000s
sys	0m0.000s
-------------e-- ./README.md
-------------e-- ./lsattr.txt
-------------e-- ./barplot

real	0m0.002s
user	0m0.000s
sys	0m0.000s

lsattr practice session . II

The following shows a command line session with lsattr 
command which helps in listing file attributes.
$lsattr 
-------------e-- ./A.txt
-------------e-- ./beautyastudyin00rothuoft.pdf
-------------e-- ./trueprint-5.4.tar.gz.sig
-------------e-- ./sample
-------------e-- ./scsh-common-0.6_0.6.7-8_all.deb
-------------e-- ./photos
-------------e-- ./beautifulwork-sorting
-------------e-- ./Templates
-------------e-- ./apache2_2.4.7-1_amd64.deb
-------------e-- ./Pictures
-------------e-- ./a.out
-------------e-- ./sent
-------------e-- ./Videos
-------------e-- ./functions.txt~
-------------e-- ./Desktop
-------------e-- ./books
-------------e-- ./myapp.rb
-------------e-- ./tmp
-------------e-- ./ethstatus_0.4.3.dsc
-------------e-- ./test.png
-------------e-- ./1
-------------e-- ./lsattr1.txt
-------------e-- ./physical.computing
-------------e-- ./rubyhw.rb
-------------e-- ./mysqlbackup
-------------e-- ./gsl
-------------e-- ./new.sass
-------------e-- ./trueangle.org
-------------e-- ./iso
-------------e-- ./#tmps#
-------------e-- ./wp-config.php
-------------e-- ./resume-micro
-------------e-- ./mathematics
-------------e-- ./source
-------------e-- ./resume-related.txt~
-------------e-- ./beautifulwork
-------------e-- ./#temp#
-------------e-- ./dap-3.8.tar.gz.sig
-------------e-- ./DMD
-------------e-- ./oo~
-------------e-- ./trueangle
-------------e-- ./dap-3.9
-------------e-- ./functions.txt
----------I--e-- ./Downloads
-------------e-- ./test.html
----------I--e-- ./National Geogrpahic compiled photos
-------------e-- ./playground
-------------e-- ./dap-3.7.tar.gz.sig
-------------e-- ./Mail
-------------e-- ./new.css
-------------e-- ./join.png
-------------e-- ./#workrecord.txt#
-------------e-- ./debian-binary
-------------e-- ./study.png
-------------e-- ./test.synctex.gz
-------------e-- ./processing
-------------e-- ./wallphotos-old
-------------e-- ./perl-new.txt
-------------e-- ./r8169
-------------e-- ./wallphotos
-------------e-- ./xf86-video-radeonhd
-------------e-- ./scsh-0.6_0.6.7-8_i386.deb
-------------e-- ./bw-wordpress
-------------e-- ./beautifulwork-ethstatus
-------------e-- ./work.png
-------------e-- ./bw-theme
-------------e-- ./beautifulwork.org-git
-------------e-- ./apache
-------------e-- ./Public
-------------e-- ./colors
-------------e-- ./ruby-related-bubblesort-related
-------------e-- ./test.aux
-------------e-- ./linux
-------------e-- ./resume-related.txt
-------------e-- ./ethstatus_0.4.3.tar.gz
-------------e-- ./testanother.html
-------------e-- ./data.tar.xz
-------------e-- ./sdata
-------------e-- ./dap-3.9.tar.gz
-------------e-- ./beautifulwork-temp
-------------e-- ./scsh_0.6.6.3_all.deb
-------------e-- ./physics
-------------e-- ./sshot.png
-------------e-- ./control.tar.gz
-------------e-- ./test.pdf
-------------e-- ./viva_jaago_zara.mp3
-------------e-- ./test.tex
-------------e-- ./Music
-------------e-- ./Documents
-------------e-- ./tem
-------------e-- ./temp
-------------e-- ./languagelearning
-------------e-- ./test.log
-------------e-- ./a.txt
-------------e-- ./filename
-------------e-- ./ahiliation.github.io
-------------e-- ./solutions
-------------e-- ./search.txt
-------------e-- ./dap-3.0.tar.gz.sig
-------------e-- ./dap
-------------e-- ./publish.png
-------------e-- ./dot-emacs
-------------e-- ./#mission#
-------------e-- ./test.html~
$

The 'e' attribute indicates that the file is using extents for mapping the blocks on  disk.  It  may not be removed using chattr.

lsattr – list file attributes on a ext2fs

The following shows a command line session with lsattr
and stat commands which helps in listing file attributes.

$lsattr -v colors 
1936034688 -------------e-- colors
$lsattr  colors 
-------------e-- colors
$ls -l colors 
-rw-r--r-- 1 jeffrin jeffrin 173 Feb 17 21:46 colors
$stat colors 
  File: ‘colors’
  Size: 173       	Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d	Inode: 3672604     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ jeffrin)   Gid: ( 1000/ jeffrin)
Access: 2014-03-30 21:42:28.074551288 +0530
Modify: 2014-02-17 21:46:33.476488095 +0530
Change: 2014-02-17 21:46:33.476488095 +0530
 Birth: -
$ls -R colors 
colors
$lsattr -R colors 
-------------e-- colors
$lsattr  resume-micro 
-------------e-- resume-micro
$lsattr  beautifulwork-sorting/
-------------e-- beautifulwork-sorting/gnu-c
-------------e-- beautifulwork-sorting/TODO
-------------e-- beautifulwork-sorting/README
-------------e-- beautifulwork-sorting/bubblesort.php
-------------e-- beautifulwork-sorting/php-hypertext-processor
-------------e-- beautifulwork-sorting/ruby
$lsattr  /bin/ls
-------------e-- /bin/ls
$lsattr  /bin/date 
-------------e-- /bin/date
$lsattr -v  /bin/date 
18446744072723245045 -------------e-- /bin/date
$stat /bin/date
  File: ‘/bin/date’
  Size: 64168     	Blocks: 128        IO Block: 4096   regular file
Device: 801h/2049d	Inode: 14418067    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-04-06 20:48:40.575978902 +0530
Modify: 2013-07-21 03:22:44.000000000 +0530
Change: 2014-02-17 22:49:42.956708864 +0530
 Birth: -
$

http://unix.stackexchange.com/questions/32256/whats-the-meaning-of-output-of-lsattr

The ‘e’ attribute indicates that the file is using extents for mapping the blocks on disk.

Showing about hidden directories

$lsattr -a
--------------e---- ./.config
--------------e---- ./Public
--------------e---- ./.atom
--------------e---- ./.profile
--------------e---- ./.gitconfig
--------------e---- ./.
--------------e---- ./Templates
--------------e---- ./Firefox_wallpaper.png
--------------e---- ./.ICEauthority
--------------e---- ./..
--------------e---- ./.pki
--------------e---- ./beautifulwork
--------------e---- ./.gconf
--------------e---- ./.local
--------------e---- ./.bash_logout
--------------e---- ./.mozilla
--------------e---- ./.cache
--------------e---- ./.gimp-2.8
--------------e---- ./.gnupg
--------------e---- ./.emacs.d
--------------e---- ./Downloads
--------------e---- ./.bash_history
--------------e---- ./Documents
--------------e---- ./.bashrc
--------------e---- ./Music
--------------e---- ./Videos
--------------e---- ./avocado
--------------e---- ./.bashrc~
--------------e---- ./Pictures
--------------e---- ./.ssh
--------------e---- ./Desktop
--------------e---- ./communications201703-dl.pdf
$