Tag Archives: commands

Linux noob command line hints

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?

del.icio.us Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati ReadMe.ru Dobavi.com Dao.bg Lubimi.com Ping.bg Pipe.bg Svejo.net Web-bg.com