Very useful computing tips for the Internet user.

If you click a link in Google and the forum post you wanted to read requires a login to view, click back and then click the green drop down arrow at the end of the link, then click the cached option. This will open a cached version of the forum posting.

Click the cached option.
Click the cached option.

This way, you can view the forum posting without a login.

If an application has frozen on a Linux machine and clicking the close button will not close it, type xkill in a terminal window and then click the frozen application. This will kill it for good.

Counting how much disk space files in a directory are taking up.

flynn@ubuntu:/media/Elements/Movies$ du -ackh | tail -n 1
65G	total

Viewing only certain files in a folder. Using the ls command and wildcards.

~$ ls -hula ../../Desktop/*.jpg
-rw-r--r-- 1 flynn flynn  28K 2012-07-10 21:39 ../../Desktop/0817-Australia-collar-bomb-suspect_full_600.jpg
-rw-r--r-- 1 flynn flynn  99K 2012-07-11 22:45 ../../Desktop/101031unknown1b.jpg
-rw-r--r-- 1 flynn flynn 3.0M 2012-07-09 21:29 ../../Desktop/1341805787928.jpg
-rw-r--r-- 1 flynn flynn 371K 2012-07-10 21:52 ../../Desktop/1341828408233.jpg
-rw-r--r-- 1 flynn flynn 2.7M 2012-07-11 22:45 ../../Desktop/1341907701198.jpg
-rw-r--r-- 1 flynn flynn 635K 2012-07-11 22:45 ../../Desktop/1342007983380.jpg
-rw-r--r-- 1 flynn flynn  59K 2012-07-11 22:45 ../../Desktop/1342008134206.jpg
-rw-r--r-- 1 flynn flynn 205K 2012-07-11 22:45 ../../Desktop/1342008295830.jpg
-rw-r--r-- 1 flynn flynn 204K 2012-07-12 22:53 ../../Desktop/1342096201790.jpg
-rw-r--r-- 1 flynn flynn  52K 2012-07-11 22:45 ../../Desktop/iphone-3gs-camera.jpg
-rw-r--r-- 1 flynn flynn 949K 2012-07-10 21:36 ../../Desktop/iphone-insides.jpg
-rw-r--r-- 1 flynn flynn 117K 2012-07-11 22:45 ../../Desktop/iphone-insides-motherboard-sml.jpg
-rw-r--r-- 1 flynn flynn 1.3M 2012-07-10 21:37 ../../Desktop/iphone-rear-of-lcd-screen.jpg
-rw-r--r-- 1 flynn flynn 150K 2012-07-11 22:45 ../../Desktop/iphone-rear-of-lcd-screen-sml.jpg
-rw-r--r-- 1 flynn flynn 1.0M 2012-07-09 21:29 ../../Desktop/london-stadium.jpg
-rw-r--r-- 1 flynn flynn  44K 2012-07-11 22:45 ../../Desktop/oap_home4.jpg

Printing out various information about your system easily. Seeing how much memory your system has and how much has been used up.

[email protected]:~$ vmstat -s
      5912404 K total memory
      5390012 K used memory
      2066764 K active memory
      2935616 K inactive memory
       522392 K free memory
      1481900 K buffer memory
      3049064 K swap cache
      2559996 K total swap
         7096 K used swap
      2552900 K free swap
      1107650 non-nice user cpu ticks
        87719 nice user cpu ticks
       313550 system cpu ticks
     23468879 idle cpu ticks
        24232 IO-wait cpu ticks
            8 IRQ cpu ticks
        64063 softirq cpu ticks
            0 stolen cpu ticks
      4082004 pages paged in
      3292808 pages paged out
            0 pages swapped in
         1774 pages swapped out
     32197903 interrupts
    158362281 CPU context switches
   1342080281 boot time
        48176 forks

Viewing information about a zipfile with the Linux command-line. Using the zipinfo command.

flynn@ubuntu:~/Downloads$ zipinfo cratnew.zip
Archive:  cratnew.zip
Zip file size: 189895 bytes, number of entries: 2
-rw-r--r--  2.3 unx   531385 bx defN 07-Jul-15 18:54 cratnew.wad
-rw-r--r--  2.3 unx     1752 tx defN 07-Jul-15 18:58 cratnew.txt
2 files, 533137 bytes uncompressed, 189609 bytes compressed:  64.4%

To view a list of the partitions mounted on your machine, you may use either of these commands. Firstly; the cat /proc/partitions command.

flynn@ubuntu:~/Documents$ cat /proc/partitions
major minor  #blocks  name
 
   8        0  488386584 sda
   8        1     440320 sda1
   8        2  358400000 sda2
   8        3  126976000 sda3
   8        4          1 sda4
   8        5    2560000 sda5
   8       16  488386584 sdb
   8       17  225280000 sdb1
   8       18   33792000 sdb2
   8       19          1 sdb3
   8       21  229238784 sdb5
  11        0    5930586 sr0
   8       32 1953514584 sdc
   8       33 1953511424 sdc1
flynn@ubuntu:~/Documents$

Or the mount(1) command, this will also list the mounted partitions on your system.

flynn@ubuntu:~/Documents$ mount
/dev/sdb1 on / type xfs (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/flynn/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=flynn)
/dev/sda1 on /media/e01436e0-4aa5-420b-94aa-0b35bd00020e type ext4 (rw,nosuid,nodev,uhelper=udisks,commit=0,commit=0)
/dev/sda3 on /media/a6f66737-afea-48c3-9694-f6da22904d37 type ext4 (rw,nosuid,nodev,uhelper=udisks,commit=0,commit=0)
/dev/sdb2 on /media/3fabc97d-c76a-4922-8705-5536e89cfd21 type ext4 (rw,nosuid,nodev,uhelper=udisks,commit=0,commit=0)
/dev/sdb5 on /media/52d826a6-7de5-45db-b693-dd7c7e82af37 type ext4 (rw,nosuid,nodev,uhelper=udisks,commit=0,commit=0)
/dev/sda2 on /media/c84b3630-79a5-4ab3-85a5-f50bc23a3da9 type xfs (rw,nosuid,nodev,uhelper=udisks)
/dev/sdc1 on /media/Elements type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sr0 on /media/300 type udf (ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077,dmode=0500)

The Linux command-line has some powerful features. The ability to filter the output of a command with grep(1) is very useful indeed. In the example below I am using the ls command and then filtering with grep.

$ ls -hula | grep conso**.wad
 
-rw-------  1 flynn flynn 2.4M 2012-07-12 22:42 consoleCopy.wad

Some incredible shell tricks. As seen in this posting: http://www.securitronlinux.com/bejiitaswrath/cispa-bill-still-a-threat-and-awesome-linux-shell-tricks/. Capitalising the first character of your username.

flynn@ubuntu:~/Documents$ echo -e ${LOGNAME^}
Flynn

And rendering the username in all caps.

flynn@ubuntu:~/Documents$ echo -e ${LOGNAME^^}
FLYNN

MSDOS styled command prompt for Linux. This is a controversial addition to your Linux system, but if you want this prompt then here it is.

PROMPT_COMMAND='export PWD_UPCASE="${PWD^^}"'
PS1='C:${PWD_UPCASE//\\//\\\\}> '

Using the df command and Listing the free space on your Linux system.

Using the Linux rename command and other useful commands.

How to use the text console on Linux to experience the Linux command-line: Linux Mint 13 text console usage.

How to install a vanilla kernel on a modern Linux distribution. Installing a kernel the vanilla way.

Some interesting Linux commands here: interesting and obscure Linux tips.

The ldd command for Linux when run against a Linux executable as I have, will return a list of the Dynamically Linked libraries that the program is linked against. This can be useful when debugging a program that you are trying to get running.

~$ ldd ./hello
	linux-vdso.so.1 =>  (0x00007fffb61ff000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fedd9a55000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fedd9e0c000)

No comments have been made. Use this form to start the conversation :)

Leave a Reply