Do not use cat when you can avoid it. This is very annoying.

The unneeded use of the cat command is very annoying, this is wasteful. Something like this is very annoying to see. cat unixhell.txt | sed ‘s/program/application/g’cat unixhell.txt | sed ‘s/program/application/g’ Do it like this instead. This is the proper way to use sed. sed ‘s/program/application/g’ unixhell.txtsed ‘s/program/application/g’ unixhell.txt The user gets the same output but … Read more

The proper way to use grep without cat. And some nice tricks.

This is the proper way to use grep. You do not need to use cat at all. This method works well and is one command, not two piping together. jason@jason-desktop:~/Documents$ grep apt-get ../.bash_history sudo apt-get update sudo apt-get install me-tv sudo apt-get update && sudo apt-get install xvst apt-get moo apt-get moojason@jason-desktop:~/Documents$ grep apt-get ../.bash_history … Read more

A better way to use grep to search files and folders. You do not need to use cat.

This is how to use grep to search a file without using cat. homer@neo:~/Documents$ grep "gcc" ../.bash_history gcc my.cpp gcc gcc hello.java gcc hello.java gcc hello.java gcc hello.java gcc mein.c -o mein gcc -c99 mein.c -o mein gcc -std=c99 mein.c -o mein gcc hello.c -o hello gcc hello.c -o hello gcc hello.c -o hello gcc … Read more

How to use the Linux cat command to read the contents of a folder. This is a cool trick.

This is a neat trick that allows you to use cat to view the contents of a directory. This library is loaded before the cat command is executed and modifies its behavior to allow you to use cat to list a directory. #include <unistd.h> #include <stdio.h> #include <dirent.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include … Read more

Linux commands that prove useful for your day to day workflow.

The UNIX tail command is very useful for viewing the last number of lines of a logfile. As in this example. Showing the last 10 lines in the file /var/log/syslog. |{~}-{Thu Feb 16 21:36:44} -{john@deep-thought } $ tail -n 10 /var/log/syslog Feb 16 21:31:01 deep-thought cron[1480]: (*system*anacron) WRONG FILE OWNER (/etc/cron.d/anacron) Feb 16 21:31:29 deep-thought … Read more

Interesting /bin/cat trick. How to join mp3 files together.

I was playing around with /bin/cat on my FreeBSD laptop and I typed this command. This is a useful trick to join mp3 files together in one long audio file. jason@Yog-Sothoth:~/Music$ cat Dune\ \(1983\)\ OST\ -\ Dune\ Prophecy\ \(Long\ Version\)-UWFm2LIYNjg.mp3 > ambient-winter.mp3jason@Yog-Sothoth:~/Music$ cat Dune\ \(1983\)\ OST\ -\ Dune\ Prophecy\ \(Long\ Version\)-UWFm2LIYNjg.mp3 > ambient-winter.mp3 And now … Read more