How to see the directory size in Linux with command line

In this Video we cover the du command. du estimate’s the file space usage

First we look at the du mange page and then we cover some real world examples

Use du to list files size

du [file]

Make du human readable

du -h

Use du to list directory size (summarize)

du -sh /home

Use du to summarize directory’s under a parent

du -h –max-depth=1 /etc

Du one file system

du -sxh /mnt

Exclude files from du

du –exclude=’*.gz’

How to see file system disk usage from command line in Linux

In this video we cover the df command. DF reports file system disk space usage. DF differs from du because it looks at the file system and not files or directories.

We look at the man page for df and then we do some examples and what the output means

List disk usage on all file systems

df -a

Df human readable

df -h /

Use DF to check inodes

df -i

Show only local filesystems

df -hl

Linux Filesystem Hierarchy

In this video I cover Linux file system hierarchy.  The somewhat loosely followed systems give some standardization to Linux distributions.

Lets look at $ man hier.

You will notice / root which is a must,  proc which is a pseudo file systems and some things missing like /dev/shm or shared memory system which is a tmpfs

 

Strip metadata from images command line

In this video I use Linux and ImageMagic to strip the location, camera information and other metadata from a jpg image file.

First we look at the image exif and other metadata with strings and identify

Next we strip the date with mogrify strip and diff the identify -verbose between the new and a backup.

Finally I go over mogrify -strip -auto-orient which will keep the proper photo geometry and orientation and we diff the strip difference.

 

Fedora 29 Mate spin post install

In this video I cover some of the things I do post install on a Fedora system.

OS update
$ dnf update

#install chrome

Set sudo wheel no password

$ sudo visudo

Block root on ssh
Disable dns lookups in sshd
Start and enable sshd
$ sudo systemctl start sshd
$ sudo systemctl enable sshd

Fix my bashrc
bind ‘”\e[A”: history-search-backward’
bind ‘”\e[B”: history-search-forward’

export HISTCONTROL=ignoreboth
export HISTSIZE=100000

Set up https://rpmfusion.org/

Disable ipv6

Disable screen saver password and power magnet for virtual guest

Tuned set virtual guest

Everything is a file in Linux

In UNIX and Linux everything is a File. Well almost.

The correct statement would be everything is a file descriptor or a process. The point to everything is a file is that common tools can be used. I/O access can be done using the same set of operations. In windows you have different reads for sockets, files and pipes with different.  With Unix/Linux treating everything as a simple file descriptor you have one read system call.  This removes the need for having multiple operations with specific uses doing the same thing.

As example of everything is a file we will take a look at a directory file.

I hope the high level overview in this video explained why to go deeper into this would get into kernel development and beyond what I do.

Linux ls command

In this video I go over the most important command in Linux which is the ls command. Ls is how to list directory content.

 

First we look at the ls man page.  then we go over some ls examples

Ls show hidden file (all)

ls -a

Ls long listing

ls -l

Ls recursive

ls -lR

Ls human readable file sizes

ls -hs

Sorting by size with ls

ls -AlhS

Shoring by size in reverse

ls -AlhSr

Sorting by modified time with ls

ls -Alt

Linux rev command

In this video I cover the rev or revers command in Linux. The rev command reverse lines characters. It comes with the util-linux package and can take input from a file or stranded out.

I think this command is little know because it doesn’t have many uses and there are other ways of doing it.