How to count the number of files in a directory?
Answer:
If you are only interested in know the number of files in a directory, try the command:
find /home/john -type f | wc -l
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to count the number of files in a directory?
Answer:
If you are only interested in know the number of files in a directory, try the command:
find /home/john -type f | wc -l
How to resolve the '/bin/rm: Argument list too long' error
Answer:
Use the xargs command, e.g.
find . -name '*' | xargs rm
The above command will find all files in the current directory and pipe the filename to xargs for using rm to removing them.
Massively rename files in Linux?
Answer:
Use the rename command.
Example: Remove the word "DSC" from all jpg files.
rename 's/DSC//' *jpg
How can I clear the command history in Linux?
Answer:
Try:
history -c
How do I run a root command on Linux?
Answer:
If sudo is installed, you can use
sudo command
or you would need to change to root by using
su -
After login as root, you can execute the command.