[HOW TO] count file and folder in Linux

Count file and folder in Linux

For files:
find directory/ -type f | wc -l

For directories:
find -mindepth 1 -type d | wc -l


Reference :

-mindepth levels
Do not apply any tests or actions at levels less than levels (a non-negative integer).  -mindepth 1 means  process all files except the starting-points.

 -type c
              File is of type c:

  • b  block (buffered) special
  • c  character (unbuffered) special
  • d  directory
  • p  named pipe (FIFO)
  • f   regular file
  • l   symbolic  link;  this  is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use -xtype.
  • s   socket
  • D  door (Solaris)
wc - print newline, word, and byte counts for each file
  • -l, --lines
              print the newline counts




Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success

[HOW TO] add Shutdown/ Restart/ Lock/ Sleep to Windows 8?

To begin, click the Desktop icon on the Start screen to access the Desktop. Right-click on the Desktop, select New/ Shortcut

Shutdown:
a. Enter the following command in the Type the location of the item edit box and click Next.
shutdown.exe -s -t 00

Enter the name for the shortcut and click Finish. To change default icon, right-click on the shortcut and select Properties. The Shortcut tab on the Properties dialog box displays. Click Change Icon. Click OK on the dialog box to close it.

Copy the shortcut and paste into C:\ProgramData\Microsoft\Windows\Start Menu\Programs

Now you can access Shutdown icon to shutdown on Windows 8.

To add icon for Restart/ Lock/ Hibernate/ Sleep, enter the following commands create new shortcuts and enter the following commands on the first screen of the Shortcut wizard.

  • Restart Computer: shutdown.exe -r -t 00
  • Lock Workstation: rundll32.exe user32.dll,LockWorkStation
  • Hibernate Computer:  rundll32.exe powrProf.dll,SetSuspendState
  • Sleep Computer:  rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Notice:
1.
The ProgramData directory is a hidden. To gain access to it, click the Hidden items check box in the Show/Hide group on the View tab.

2.
Because the shutdown.exe program you specified has no icons associated whit it, the following message displays. Click OK.

By default, the icons in the shell32.dll file display. You can use the Browse button to select another .exe, .dll, .ico.

3.
The rundll32.exe file does have an icon available; however, you may want to change it. Use the Browse button to access a file with more icons. The shell32.dll file is located in C:\Windows\System32.
NOTE: For the Hibernate and Sleep options, make sure that the hardware in your computer support these options and that they are enabled.


Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success

[HOW TO] by pass Failed to connect, CredSSP required by server on Windows 8 Embedded

Hello,

On Fedora, I must remote desktop to Windows 8.1 Embedded.
I could not remote desktop and got the result:

[itien@201407COM0047 ~]$ rdesktop 10.10.21.129
Autoselected keyboard map en-us
Failed to connect, CredSSP required by server.


How to bypass?

On Windows 8.1 Embedded, you must go to System Properties/ Remote. Please un-check "All connection only from computer running Remote Desktop with Network Level Authentication (recommended)



Try remote from your Linux :)

Windows 8.1 based on Windows 8. Therefore you can do the same.


Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success