Count Number of Files and Folders in a Directory Using Terminal

I Googled so much and can’t find any simpler method to count files or folders in a directory in Linux. I am using Ubuntu 14.04. If it’s only files and folders, it would be simple.

Count Files and Folders

$ ls -l | wc -l

The wc -l command is read “WordCount lines”. It means after you executed the ls, the corresponding result will be counted by it’s line. For example, if you are using ls in your working directory, say there are 2 files and 2 folders, it will return 4 lines. If you add it becomes ls -a, it will return 2 more lines. So, it returns 6 lines because of “.” and “..” are counted.

Continue reading Count Number of Files and Folders in a Directory Using Terminal

How to Sign in as ROOT in Ubuntu Terminal

You can sign in as ROOT in Ubuntu Terminal without password in the first time by typing

sudo bash

After that you can change the password for the ROOT by typing

sudo passwd root

And then you type the password. Don’t afraid when you type there is no character appears because it is the default. It is recording what you type.

If you’ve changed the password you can sign as ROOT by typing

su root

or

su

For further reading you can read Sudo Manual and SU Command in Wikipedia