A nice program to list files in a directory. A version of ls.
A nice version of ls in a compact C program for Linux.
Read MoreA nice version of ls in a compact C program for Linux.
Read MoreHow to print ascii code with the terminal and other tips for Linux.
Read MoreThis is how to list files on a Linux system with ls and not show the permissions. jason@. PWD: ~/Documents/UNIX. -bash. 3.2.57. 9 $> ls -SAghof | cut -d’ ‘ -f3- 15 480B 2 Nov 2015 . 2.2K 14 Jul 13:38 .. 1 706B 19 Mar 2014 hah1 1…
Read MoreThis is a very interesting bash trick I found using ls. This runs the ls command with random parameters. This is not very useful, but interesting nonetheless. 4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | tr -dc ‘hula’ | head –bytes 1`4.4 Tue Mar 03 jason@Yog-Sothoth 0:…
Read MoreSorting the output of ls by date modified is very easy. This is how to sort output and display the few most recent files. This example shows how to do this. Use head – 20 to list only the top 20 results. 4.4 Tue May 21 jason@Yog-Sothoth 0: $ ls…
Read MoreThe ls command on Mac OSX works a little differently than on a Linux machine, but listing only directories is very simple. This is one example, using only the ls command. deusexmachina:Documents jason$ ls -ld — */ drwxr-xr-x 3 jason staff 102 5 Mar 2018 POL/ drwxrwxrwx 31 jason staff…
Read MoreThere 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…
Read MoreThis 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…
Read MoreThis 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" ./…
Read MoreUsing 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 ~ $…
Read MoreTo 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…
Read MoreUsing 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…
Read MoreThe 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…
Read MoreThe 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…
Read MoreThis 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…
Read MoreUptime. 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…
Read MoreThis 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…
Read MoreThis 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…
Read MoreUsing 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…
Read MoreBelow 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…
Read More