Useful commands in Linux

View the job launched via process id
xargs -0 < /proc/<pid>/cmdline
Get the history of commands run from a user.
grep -e "$pattern" /home/*/.bash_history


How to find the files difference between two directories in linux and also
ignoring the extension?

 
comm -13 <(find dir1 -type f -exec bash -c 'basename "${0%.*}"' {} \;   
| sort) <(find dir2 -type f -exec bash -c 'basename "${0%.*}"' {} \; 
 | sort) 
 
Type the above command in one line.

comm -13 - will show the filenames unique to directory 2
comm -12 - will show all filenames common to both directories
comm -23 - will show the filenames unique to directory 1.


grep -F -x -v -f fileB fileA
 
 
Github change author name without edit 
 
git rebase -i HEAD~4 -x "git commit --amend --author 'name <email>' --no-edit" 
 
 
Command to count the file extension of a particular type. 
find . -type f | sed -n 's/..*\.//p' | sort | uniq -c

Copy fastest using tar

tar cf - * | mbuffer -m 1024M | ssh user@host '(cd /home/path; tar xf -)'

Comments

Popular posts from this blog

SOX - Sound eXchange - How to use SOX for audio processing tasks in research.

Sox of Silence - Original post - http://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/

How to get video or audio duration of a file using ffmpeg?