Very useful tips for all Linux users. Good to know for anyone using Ubuntu or Mint.

There are many ways to list directories and sort the results by size. I have just found another way. Use the ls command with the -S parameter. This sorts files by size. Very useful way to get the largest files in a certain directory. Linux has so many varied methods of listing files, it is … Read more

How to list all dotfiles in your home directory with a nice on-liner.

This nice on-liner will list all dotfiles in your home directory that start with b to z. Another good way to accomplish this task. jason@Yog-Sothoth » ~ » $ ls -hula -d .[b-z]* |grep -v ^d -rw——- 1 jason jason 13K Jun 20 10:45 .bash_history -rw-r–r– 1 jason jason 220 Jun 20 10:45 .bash_logout -rw-rw-r– … Read more

An alternative to the ls command to print a directory listing.

This is a good alternative to the ls command to print a directory listing. This is very useful for quickly viewing the contents of a directory. ┌─[jason@parrot]─[~/Documents] └──╼ $find ./ -printf "%f\n" ./ password-01.kismet.netxml password-01.cap read.c out.xml netcomm.txt a.out password-01.kismet.csv rockyou.txt password-01.csv mysql.txt notify.js┌─[jason@parrot]─[~/Documents] └──╼ $find ./ -printf "%f\n" ./ password-01.kismet.netxml password-01.cap read.c out.xml netcomm.txt … Read more

Useful Linux/UNIX commands.

Using wild-cards to display various files in a folder with ls. I recently needed to check whether certain files were in the /usr/lib folder and I used the ls command to do this. to find all files related to the Perl programming language in the /usr/lib directory. ubuntu ~ $ ls /usr/lib/*perl* /usr/lib/libperl.so.5.18 /usr/lib/libperl.so.5.18.2   … Read more

Some useful tips for listing directories with ls on Linux.

To list the contents of a directory with the listing sorted by size, use the parameters in this example. ls –format=long –sort=size -hls –format=long –sort=size -h This is what you will get. total 15G -rw-rw-r– 1 ubuntu ubuntu 15G Dec 2 2014 crackstation.txt -rw-rw-r– 1 ubuntu ubuntu 20M Mar 20 2015 system.save -rw-rw-r– 1 ubuntu … Read more

How to use the sed command to filter text files in Linux and other useful shell tricks for the Linux command line.

Using sed to filter a text file and change a specific character for another. In this case the ” character becomes the ‘ character using the magic of the sed command. Since I am using a character the shell also uses I have to escape it out so the command will work. This can make … Read more

How to list more than one thing at a time with the /bin/ls command for Linux.

The ls command for Linux may be used to list more than one thing at a time. These examples demonstrate this. homer@deusexmachina ~ $ ls -p /opt/ /bin/rm /bin/rm   /opt/: firefox/ mint-flashplugin-11/homer@deusexmachina ~ $ ls -p /opt/ /bin/rm /bin/rm /opt/: firefox/ mint-flashplugin-11/ Here is a more verbose version of this command. With human readable … Read more

Use ls to only list files that start with an uppercase character.

The ls command may be used in conjunction with grep to list files that start with an uppercase letter or have an uppercase filename. ┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ ls | grep "^[A-Z]" Boomsrc Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f140.m4a Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f160.mp4 Hope is the good thing(The Shawshank … Read more

List files by modification date with the ls command on Linux.

This one-liner will list all files in a directory by modification time, newest first. jason@eyjafjallajkull:~/Pictures$ ls -thuljason@eyjafjallajkull:~/Pictures$ ls -thul Use it this way to list the top 20 files listed. jason@eyjafjallajkull:/var/log$ ls -thul | head -n 20 total 6.9M -rw-rw-r– 1 root utmp 9.0K Jul 9 11:30 wtmp -rw-r–r– 1 root root 85K Jul 9 … Read more

Misc UNIX and Linux tricks for the desktop user and administrator.

Uptime. this is a useful command for finding out how long a Linux system has been running for. it also displays the load average over 1.5 and 15 minute intervals. deep-thought ~ # uptime 21:45:32 up 32 min, 3 users, load average: 1.88, 1.45, 1.08deep-thought ~ # uptime 21:45:32 up 32 min, 3 users, load … Read more

Some miscellaneous BASH tricks. Useful tips for all Linux users.

This command shows how to display a listing of files with ls and show line numbers at the same time. homer@deep-thought ~/Desktop/Site % ls | nl 1 back.jpg 2 bejiitas_phpb1 3 bejiitas_phpb1.sql 4 cgi-bin 5 Files.tar.lzma 6 Map07Tufb.zip 7 my2.tar.lzma 8 program.c 9 quake38.jpg 10 sysinfo 11 tekcrazy_2.zip 12 wrap.rarhomer@deep-thought ~/Desktop/Site % ls | nl … Read more

More awesome shell tricks for the Linux command line. This is using the bash shell.

This is another way to see where you are in the directory stack. homer@deep-thought ~/Documents/basenew $ echo $DIRSTACK ~/Documents/basenewhomer@deep-thought ~/Documents/basenew $ echo $DIRSTACK ~/Documents/basenew Here is another way to show the $PWD value one directory down from where you are now. homer@deep-thought ~/Documents/basenew $ echo $OLDPWD /home/homer/Documentshomer@deep-thought ~/Documents/basenew $ echo $OLDPWD /home/homer/Documents This example shows … Read more

How to filter text with the sed command. This is useful for various shell tricks.

Using wildcards on the Linux command line This is a standard listing of files with wildcards in the bash shell. homer@deep-thought ~/Documents $ ls *.wad basenew.wad cc4-tex.wad city-heat.wad dark.wad doom.wad plutonia.wad scythe2.wad SKYTEST.wad brick.wad cchest4.wad consoleCopy.wad doom2.wad hexen.wad RIII.wad scythex.wad SODfinal.wadhomer@deep-thought ~/Documents $ ls *.wad basenew.wad cc4-tex.wad city-heat.wad dark.wad doom.wad plutonia.wad scythe2.wad SKYTEST.wad brick.wad cchest4.wad … Read more

How to use color in the ls command to brighten up your directory listings.

Below we see output of the ls command when listing a directory. The –color=auto parameter allows the use of color if your terminal supports it. And since everyone either uses Konsole or Gnome Terminal; this command will always work. I am using zsh at the moment; but this works with just about any shell. ls … Read more