Using the Linux rename command and other useful commands for Linux Mint 13.

The rename command for the Linux shell allows you to rename a directory full of files en-mass.

This first example, based on the examples in the rename manual page. Firstly renaming a directory full of xhtml files to the html extension.

rename 's/\.xhtml$/.html/' *.xhtml

And renaming a folder full of Jpeg files with an upper case extension to lower case.

rename 's/\.JPG$/.jpg/' *.JPG

The convert command, part of the ImageMagick(1) suite of tools is a useful command, it will convert an image from one format to another, as in the below example.

convert darcymonk120706channel7257.jpeg darcymonk120706channel7257.png

The du command is used to see the amount of space taken up by a directory. The example below is using the du command and piping it to the sort and head commands. This command will print out a human-readable output of how much space a directory is taking up.

C:\HOME\FLYNN\PICTURES> du -ackh | sort -nr | head -n 23
988K	./1338670924844.jpeg
980K	./radiationcount-8.png
900K	./radiationcount-2.png
632K	./1339123707834.jpeg
544K	./1339122429238.jpeg
520K	./radiationcount-16.png
516K	./1339247594593.png
464K	./radiationcount-11.png
456K	./Blog-SingingRain.jpeg
396K	./radiationcount-4.png
392K	./radiationcount-15.png
372K	./pdp-8.jpeg
364K	./1338612404563jpeg
332K	./radiationcount-0.png
308K	./railway2jpeg
120K	./DSCF2461.jpg
116K	./GUNS2_2241428bjpeg
116K	./1338592719579.jpeg
112K	./radiationcount-1.png
112K	./radiationcount-13.png
112K	./darcymonk120706channel7257.png
103M	total
103M	.

Using the tree command, you may print out a DOS styled tree view directory listing.

C:\HOME\FLYNN\PICTURES> tree -A -s -p -f --dirsfirst
.
├── [-rw-r--r--       64615]  ./1338473373167.jpeg
├── [-rw-r--r--       31503]  ./1338510527630.jpeg
├── [-rw-r--r--      117826]  ./1338592719579.jpeg
├── [-rw-r--r--      371032]  ./1338612404563jpeg
├── [-rw-r--r--     1010257]  ./1338670924844.jpeg
├── [-rw-r--r--       59794]  ./1338825411389.jpeg
├── [-rw-r--r--       19816]  ./1338903886006.jpeg
├── [-rw-r--r--      556989]  ./1339122429238.jpeg
├── [-rw-r--r--      647142]  ./1339123707834.jpeg
├── [-rw-r--r--      525544]  ./1339247594593.png
├── [-rw-r--r--       67865]  ./1339249964523.jpeg
├── [-rw-r--r--       37908]  ./1339343643333.png
├── [-rw-r--r--     2036958]  ./1339507574545.jpeg
├── [-rw-r--r--     2090606]  ./1339556066175.gif
├── [-rw-r--r--        3869]  ./1339576195840.jpeg
├── [-rw-r--r--       75727]  ./5354908_orig.jpeg
├── [-rw-r--r--        4157]  ./ajushi.gif
├── [-rw-rw-r--      465713]  ./Blog-SingingRain.jpeg
├── [-rw-r--r--       25977]  ./darcymonk120706channel7257.jpeg
├── [-rw-r--r--      113859]  ./darcymonk120706channel7257.png
├── [-rw-r--r--     5064698]  ./DSCF2294.jpg
├── [-rw-r--r--     5117330]  ./DSCF2298.jpg
├── [-rw-r--r--     4522982]  ./DSCF2459.jpg
├── [-rw-r--r--     4908757]  ./DSCF2460.jpg
├── [-rw-r--r--      119198]  ./DSCF2461.jpg
├── [-rw-r--r--     2710177]  ./DSCF2495.jpg
├── [-rw-r--r--    49145092]  ./DSCF2557.AVI
├── [-rw-r--r--      118686]  ./GUNS2_2241428bjpeg
├── [-rw-r--r--        6608]  ./helicoptersradiation-235x156jpeg
├── [-rw-r--r--       27795]  ./hyper.gif
├── [-rw-r--r--       21113]  ./illuminati.gif
├── [-rw-r--r--       32208]  ./nuclearcoverupscreenshot.png
├── [-rw-r--r--      378674]  ./pdp-8.jpeg
├── [-rw-r--r--       62005]  ./prometheusjpeg
├── [-rw-r--r--      336985]  ./radiationcount-0.png
├── [-rw-r--r--        6339]  ./radiationcount-10.png
├── [-rw-r--r--      474379]  ./radiationcount-11.png
├── [-rw-r--r--     1969226]  ./radiationcount-12.png
├── [-rw-r--r--      113859]  ./radiationcount-13.png
├── [-rw-r--r--     1089856]  ./radiationcount-14.png
├── [-rw-r--r--      399265]  ./radiationcount-15.png
├── [-rw-r--r--      530495]  ./radiationcount-16.png
├── [-rw-r--r--       37916]  ./radiationcount-17.png
├── [-rw-r--r--       33956]  ./radiationcount-18.png
├── [-rw-r--r--      114242]  ./radiationcount-1.png
├── [-rw-r--r--      920891]  ./radiationcount-2.png
├── [-rw-r--r--     3421929]  ./radiationcount-3.png
├── [-rw-r--r--      405296]  ./radiationcount-4.png
├── [-rw-r--r--       60794]  ./radiationcount-5.png
├── [-rw-r--r--    10778893]  ./radiationcount-6.png
├── [-rw-r--r--     3908761]  ./radiationcount-7.png
├── [-rw-r--r--      999903]  ./radiationcount-8.png
├── [-rw-r--r--     1171555]  ./radiationcount-9.png
├── [-rw-r--r--       45995]  ./radiationcount.png
├── [-rw-r--r--      312681]  ./railway2jpeg
└── [-rw-r--r--       75061]  ./x37.jpeg

0 directories, 56 files

The pstree command prints out a tree view listing of the running Linux processes. This makes it very easy to visualise how all other processes descend from ‘init’ which is the parent of all Linux processes.

C:\HOME\FLYNN\PICTURES> pstree -a -u -G -l -h -p
init,1
  ├─NetworkManager,930
  │   ├─dhclient,1120 -d -4 -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/sendsigs.omit.d/network-manager.dhclient-eth0.pid -lf /var/lib/dhcp/dhclient-dafcb050-8698-43d8-bc2a-dda90074db6e-eth0.lease -cf /var/run/nm-dhclient-eth0.conf eth0
  │   ├─dnsmasq,1844,nobody --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
  │   ├─{NetworkManager},945
  │   └─{NetworkManager},1121
  ├─SystemToolsBack,2438 /usr/share/system-tools-backends-2.0/scripts/SystemToolsBackends.pl -m Platform
  ├─acpid,1264 -c /etc/acpi/events -s /var/run/acpid.socket
  ├─at-spi-bus-laun,2586,flynn
  │   ├─{at-spi-bus-laun},2587
  │   └─{at-spi-bus-laun},2589
  ├─atd,1268,daemon
  ├─avahi-daemon,957,avahi
  │   └─avahi-daemon,958
  ├─bluetoothd,905
  ├─clock-applet,2382,flynn
  │   └─{clock-applet},2389
  ├─console-kit-dae,1655 --no-daemon
  │   ├─{console-kit-dae},1656
  │   ├─{console-kit-dae},1657
  │   ├─{console-kit-dae},1659
  │   ├─{console-kit-dae},1660
  │   ├─{console-kit-dae},1661
  │   ├─{console-kit-dae},1662
  │   ├─{console-kit-dae},1665
  │   ├─{console-kit-dae},1666
  │   ├─{console-kit-dae},1667
  │   ├─{console-kit-dae},1668
  │   ├─{console-kit-dae},1669
  │   ├─{console-kit-dae},1670
  │   ├─{console-kit-dae},1671
  │   ├─{console-kit-dae},1672
  │   ├─{console-kit-dae},1673
  │   ├─{console-kit-dae},1674
  │   ├─{console-kit-dae},1675
  │   ├─{console-kit-dae},1676
  │   ├─{console-kit-dae},1677
  │   ├─{console-kit-dae},1678
  │   ├─{console-kit-dae},1679
  │   ├─{console-kit-dae},1680
  │   ├─{console-kit-dae},1681
  │   ├─{console-kit-dae},1682
  │   ├─{console-kit-dae},1683
  │   ├─{console-kit-dae},1684
  │   ├─{console-kit-dae},1685
  │   ├─{console-kit-dae},1686
  │   ├─{console-kit-dae},1687
  │   ├─{console-kit-dae},1688
  │   ├─{console-kit-dae},1689
  │   ├─{console-kit-dae},1690
  │   ├─{console-kit-dae},1691
  │   ├─{console-kit-dae},1692
  │   ├─{console-kit-dae},1693
  │   ├─{console-kit-dae},1694
  │   ├─{console-kit-dae},1695
  │   ├─{console-kit-dae},1696
  │   ├─{console-kit-dae},1697
  │   ├─{console-kit-dae},1698
  │   ├─{console-kit-dae},1699
  │   ├─{console-kit-dae},1700
  │   ├─{console-kit-dae},1701
  │   ├─{console-kit-dae},1702
  │   ├─{console-kit-dae},1703
  │   ├─{console-kit-dae},1704
  │   ├─{console-kit-dae},1705
  │   ├─{console-kit-dae},1706
  │   ├─{console-kit-dae},1707
  │   ├─{console-kit-dae},1708
  │   ├─{console-kit-dae},1709
  │   ├─{console-kit-dae},1710
  │   ├─{console-kit-dae},1711
  │   ├─{console-kit-dae},1712
  │   ├─{console-kit-dae},1713
  │   ├─{console-kit-dae},1714
  │   ├─{console-kit-dae},1715
  │   ├─{console-kit-dae},1716
  │   ├─{console-kit-dae},1717
  │   ├─{console-kit-dae},1719
  │   ├─{console-kit-dae},1720
  │   ├─{console-kit-dae},1927
  │   ├─{console-kit-dae},8694
  │   └─{console-kit-dae},8696
  ├─cron,1263
  ├─cupsd,952 -F
  ├─dbus-daemon,889,messagebus --system --fork --activation=upstart
  ├─dbus-daemon,2039,flynn --fork --print-pid 5 --print-address 9 --session
  ├─dbus-launch,2038,flynn --exit-with-session mate-session
  ├─dconf-service,2953,flynn
  │   ├─{dconf-service},2954
  │   └─{dconf-service},2956
  ├─firefox,9607,flynn
  │   ├─{firefox},9612
  │   ├─{firefox},9613
  │   ├─{firefox},9614
  │   ├─{firefox},9615
  │   ├─{firefox},9617
  │   ├─{firefox},9618
  │   ├─{firefox},9619
  │   ├─{firefox},9620
  │   ├─{firefox},9621
  │   ├─{firefox},9623
  │   ├─{firefox},9626
  │   ├─{firefox},9628
  │   ├─{firefox},9629
  │   ├─{firefox},9630
  │   ├─{firefox},9631
  │   ├─{firefox},9632
  │   ├─{firefox},9634
  │   ├─{firefox},9635
  │   ├─{firefox},9636
  │   ├─{firefox},9638
  │   └─{firefox},9838
  ├─gconfd-2,2079,flynn
  ├─getty,1197 -8 38400 tty4
  ├─getty,1205 -8 38400 tty5
  ├─getty,1242 -8 38400 tty3
  ├─getty,1247 -8 38400 tty6
  ├─getty,1643 -8 38400 tty1
  ├─gvfs-afc-volume,2094,flynn
  │   └─{gvfs-afc-volume},2095
  ├─gvfs-fuse-daemo,2062,flynn -f /home/flynn/.gvfs
  │   ├─{gvfs-fuse-daemo},2065
  │   ├─{gvfs-fuse-daemo},2066
  │   └─{gvfs-fuse-daemo},2067
  ├─gvfs-gdu-volume,2084,flynn
  ├─gvfs-gphoto2-vo,2092,flynn
  ├─gvfsd,2060,flynn
  ├─gvfsd-computer,2458,flynn --spawner :1.13 /org/gtk/gvfs/exec_spaw/1
  ├─gvfsd-metadata,2428,flynn
  ├─gvfsd-trash,2400,flynn --spawner :1.13 /org/gtk/gvfs/exec_spaw/0
  ├─irqbalance,1283
  ├─kded4,3118,flynn  
  │   └─{kded4},3120
  ├─kdeinit4,3113,flynn
  │   ├─kio_http_cache_,3160
  │   └─klauncher,3116
  ├─kuiserver,10018,flynn
  │   └─{kuiserver},10020
  ├─kwalletd,3210,flynn
  │   └─{kwalletd},3212
  ├─leafpad,10068,flynn
  │   └─{leafpad},10072
  ├─login,1237 --      
  │   └─bash,8578,flynn
  ├─mate-keyring-da,2054,flynn --start --components=ssh
  │   ├─{mate-keyring-da},2055
  │   ├─{mate-keyring-da},2056
  │   ├─{mate-keyring-da},2057
  │   └─{mate-keyring-da},2058
  ├─mate-screensave,2377,flynn
  ├─mate-settings-d,2052,flynn
  │   └─{mate-settings-d},2053
  ├─mate-terminal,8783,flynn
  │   ├─bash,8789
  │   │   └─pstree,18579 -a -u -G -l -h -p
  │   ├─bash,9686
  │   ├─(mate-terminal,8788)
  │   ├─{mate-terminal},8787
  │   └─{mate-terminal},8790
  ├─matecomponent-a,2113,flynn --ac-activate --ior-output-fd=19
  │   ├─{matecomponent-a},2132
  │   └─{matecomponent-a},2152
  ├─mateconfd-2,2044,flynn
  ├─mateweather-app,2379,flynn
  │   └─{mateweather-app},2390
  ├─mdm,1398
  │   └─mdm,1400
  │       ├─Xorg,1928 :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt9
  │       └─mate-session,1951,flynn
  │           ├─applet.py,2097 /usr/share/system-config-printer/applet.py
  │           ├─caja,2096
  │           │   └─{caja},2154
  │           ├─mate-bluetooth-,2117
  │           │   ├─{mate-bluetooth-},2148
  │           │   └─{mate-bluetooth-},2149
  │           ├─mate-panel,2081
  │           │   └─{mate-panel},2082
  │           ├─mate-power-mana,2101
  │           │   └─{mate-power-mana},2147
  │           ├─mate-volume-con,2115
  │           ├─mintupdate-laun,2134 /usr/bin/mintupdate-launcher
  │           │   └─sh,2143 -c /usr/lib/linuxmint/mintUpdate/mintUpdate.py
  │           │       └─mintUpdate,2144 /usr/lib/linuxmint/mintUpdate/mintUpdate.py
  │           │           ├─{mintUpdate},2199
  │           │           └─{mintUpdate},2393
  │           ├─nm-applet,2141
  │           │   └─{nm-applet},2225
  │           ├─polkit-mate-aut,2142
  │           │   └─{polkit-mate-aut},2181
  │           ├─ssh-agent,2035 /usr/bin/dbus-launch --exit-with-session mate-session
  │           ├─zeitgeist-datah,2099
  │           │   └─{zeitgeist-datah},2106
  │           ├─{mate-session},2042
  │           └─{mate-session},2046
  ├─modem-manager,903
  ├─mount.ntfs,2483 /dev/sdc1 /media/Elements -o rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,dmask=0077,fmask=0177
  ├─nmbd,1901 -D
  ├─notification-ar,2383,flynn
  │   └─{notification-ar},2386
  ├─openbox,9604,flynn --replace
  ├─plymouth-upstar,900
  ├─plymouthd,294 --mode=boot --attach-to-session
  ├─polkitd,947 --no-debug
  │   └─{polkitd},949
  ├─pulseaudio,2071,flynn --start --log-target=syslog
  │   ├─gconf-helper,2077
  │   ├─{pulseaudio},2076
  │   ├─{pulseaudio},2089
  │   └─{pulseaudio},2090
  ├─rsyslogd,955,syslog -c5
  │   ├─{rsyslogd},959
  │   ├─{rsyslogd},960
  │   └─{rsyslogd},961
  ├─rtkit-daemon,2073,rtkit
  │   ├─{rtkit-daemon},2074
  │   └─{rtkit-daemon},2075
  ├─smbd,891 -F
  │   └─smbd,911 -F
  ├─system-tools-ba,2403
  │   └─{system-tools-ba},2412
  ├─timidity,1632,timidity -Os -iAD
  ├─udevd,351 --daemon
  │   ├─udevd,3995 --daemon
  │   └─udevd,3996 --daemon
  ├─udisks-daemon,2086
  │   ├─udisks-daemon,2087
  │   ├─{udisks-daemon},2088
  │   └─{udisks-daemon},2406
  ├─upowerd,2160
  │   ├─{upowerd},2161
  │   └─{upowerd},2162
  ├─upstart-socket-,618 --daemon
  ├─upstart-udev-br,345 --daemon
  ├─whoopsie,1279,whoopsie
  │   └─{whoopsie},1294
  ├─winbindd,1373
  │   └─winbindd,1397
  ├─wnck-applet,2180,flynn
  │   └─{wnck-applet},2341
  ├─xawtv,3934,flynn
  │   ├─{xawtv},3937
  │   └─{xawtv},3938
  ├─zeitgeist-daemo,2108,flynn
  │   └─{zeitgeist-daemo},2110
  └─zeitgeist-fts,2123,flynn
      ├─cat,2131
      └─{zeitgeist-fts},2126

Post a Comment

Your email is kept private. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>