Posts Tagged With: files

Command to View just the Files

Tagged with: , , ,

View just the files of directory


ls -F
No Comments »

Command to Sort Files by Size

Tagged with: , , , , ,

Show size of the files and directories sorted by size


du -sk * | sort -rn
No Comments »

cmp Command - Compare Files

Tagged with: , , , , ,

The command cmp is similar to diff:


# cmp file1 file2
file1 file2 differ: byte 10, line 1
No Comments »

Basic Diff

Tagged with: , , , , ,

If you use the diff command, you will be able to see the difference between the files as shown below:


diff file1 file2

diff -y file1 file2 -W 120 #View side by side
No Comments »

Concatinate Files in Linux

Tagged with: , , , ,

This is how you concatinate multiple files in linux…


cat file1 file2 file3 > final_file
No Comments »

Change the Extension of Multiple Files in Linux

Tagged with: , , , ,

In this example, we will change all files with extension ‘.info’ to ‘.txt’.

Rename all *.info files in one folder

rename .info .txt *.info

That should read as..

rename <replace this string> <with this string> <in all these files>

Do the same operation recursively in a directory tree

find . -name "*.info" -exec rename .info .txt {} \;

Those double quotes around *.info are important - don’t remove them mm-kay?

[tags]rename,multiple,command,linux,files[/tags]

No Comments »