I've been working with Linux for a couple of years but I'm not sysadmin so I use the parts of the system that I need at work. Mostly different activities with user interface interactions (which is similar to Windows behavior). However working on remote servers, comparing data, transfering and managing projects requires ssh-ing, some file management, archiving, searching in file system, filtering data, hiding folders etc. Here there are few of the tips I've used in the past days and I find useful:
Create/Extract archive ('z' option could be added as well if working with tar.gz files):
tar cvf archive.tar directory
tar xvf archive.tar
Print/list the content of a tar archive:
tar -tvf archive.tar
Create an archive from a SVN-based project excluding SVN:
tar --exclude=.svn -c -f archive.tar projectdirectory
Works for copying an SVN directory with rsync without .svn subdirectories:
rsync --exclude=.svn -r somedirectory somenewplace
Find differences between 2 directories with changes in each file:
diff -r directory1 directory2
Print only file names of different files in 2 similar directories:
diff -r -q directory1 directory2
Filter the 2 directories comparison and hide the .svn entries from output
diff -r -q directory1 directory2 | grep -v .svn
Copy data directory from local machine to a remote machine via SSH (reverse paths for vise verse):
scp -r yourdirectory root@yourserver.com:/some/path/here
Any tips from you?
Nice hints on locate, find and grep (with graphics), and also using the time function for sample benchmarks:
http://www.secguru.com/article/quick_tips_find_files_linux_file_system
Deleting all files with given name pattern recursively from a directory:
find /path -type f -name "*~" -exec rm {} +
http://www.osguides.net/operation-systems/217-how-to-create-xorgconf-in-ubuntu-910.html
Exporting variables, for, let’s say, Grails setup:
export GRAILS_HOME=/home/theuser/Software/grails-2.1.0/
export PATH=”$PATH:$GRAILS_HOME/bin”