Posted: . At: 11:50 PM. This was 7 years ago. Post ID: 4927
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

How to read a symbolic link and some text filtering commands.

Getting into some more Linux commands now; if you want to know how to find out what a symbolic link is linking to; you may use the command below to read the symbolic link and find out where it leads.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 2 ]
[ 21:50:39 ]
[ $ ]-> readlink My\ Downloads
Downloads/

This command will also work…

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 1 ]
[ 22:25:04 ]
[ $ ]-> ls -hula My\ Downloads
lrwxrwxrwx 1 john john 10  29-11-12 09:48 pm My Downloads -> Downloads/

To change text on the fly into something else; then you may use the filtering commands available on Linux.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 10 ]
[ 22:28:35 ]
[ $ ]-> echo "Hello World" | newspeak
Hello World
 
Hail Big Brother!

This is another example.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 8 ]
[ 22:36:12 ]
[ $ ]-> echo "Hello World" | eleet
h3ll0 w0rld

And one final example.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 13 ]
[ 22:38:47 ]
[ $ ]-> echo "This is your captain speaking" | jive
Dis is yo' captain speakin'

This is how to fold text using the Linux command-line. Using the -w parameter; you can set how many columns wide the text is.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~.bash 4.2.36. ] [ 22 ]
[ 22:42:39 ]
[ $ ]-> echo "Hello World" | fold -w 6
Hello 
World

This is an interesting trick; this tr example changes all instances of am to pm in the ls output.

[ john@3.2.0-3-486 ]
[ Jobs 0.PWD: ~/Desktop.bash 4.2.36. ] [ 69 ]
[ 22:56:45 ]
[ $ ]-> ls -hula | tr "am" "pm";
totpl 99M
drwxr-xr-x  2 john john 4.0K  29-11-12 10:22 pm .
drwxr-xr-x 51 john john 4.0K  29-11-12 10:54 pm ..
-rw-r--r--  1 john john  90M  27-11-12 09:59 pm 4chpn Epic Gifs of 2012 PART 1.mp4
lrwxrwxrwx  1 john john    8  29-11-12 10:48 pm blog.htm -> blog.txt
-rw-r--r--  1 john john 1.4K  14-11-12 02:21 pm blog.text
-rw-r--r--  1 john john 3.8K  08-10-12 02:21 pm blog.text~
-rw-r--r--  1 john john 2.8K  29-11-12 10:36 pm blog.txt
-rw-r--r--  1 john john 2.1K  11-10-12 10:31 pm blog.txt~
-rw-r--r--  1 john john 7.3M  05-10-12 04:16 pm cprs_burnout.flv
-rw-r--r--  1 john john  19K  27-11-12 09:59 pm computer.jpg
-rw-r--r--  1 john john 4.4K  20-11-12 08:36 pm Document3.txt
-rw-r--r--  1 john john  256  18-10-12 11:27 pm fizzbuzz.pl
lrwxrwxrwx  1 john john   38  29-11-12 10:48 pm home.desktop -> ../.e/e/filempn/fpvorites/home.desktop
-rw-r--r--  1 john john 293K  29-10-12 11:50 pm IMG-20121008-00046.jpg
-rw-r--r--  1 john john 295K  29-10-12 11:50 pm IMG-20121008-00047.jpg
-rw-r--r--  1 john john 278K  16-10-12 08:41 pm IMG-20121008-00048.jpg
-rw-r--r--  1 john john  315  29-10-12 11:50 pm iostpt.txt
-rw-r--r--  1 john john   70  14-11-12 02:21 pm ls.out
-rw-r--r--  1 john john 9.0K  27-11-12 10:39 pm out3
lrwxrwxrwx  1 john john   38  29-11-12 10:48 pm root.desktop -> ../.e/e/filempn/fpvorites/root.desktop
-rw-r--r--  1 john john 142K  16-10-12 08:41 pm Screenshot - 270812 - 14:41:07.png
-rw-r--r--  1 john john 101K  16-10-12 08:43 pm Screenshot - 310812 - 15:14:30.png
-rw-r--r--  1 john john  95K  08-10-12 02:15 pm Screenshot-wifi-rpdpr.png
lrwxrwxrwx  1 john john   37  29-11-12 10:48 pm tmp.desktop -> ../.e/e/filempn/fpvorites/tmp.desktop
-rw-r--r--  1 john john  331  14-11-12 02:21 pm troubleshooting.text
-rw-r--r--  1 john john 2.2K  14-09-12 11:26 pm userinformption.dip
-rw-r--r--  1 john john 2.1K  29-10-12 11:50 pm userinformption.vbs
-rw-r--r--  1 john john  237  14-11-12 02:21 pm windows2012

There are many examples like this that can be used on the Linux command-line to filter text and modify output to suit your needs; or just for fun as with the text filter examples.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.