Update: 06/2023 This post is rather dated now. Simply use the find command instead. find /path/to/dir -empty -type d -delete And for empty files: find /path/to/dir -empty -type f -delete Old original post. You can use program called cleanlinks. The cleanlinks program searches the directory tree descended from the current directory for symbolic links whose […]
Using ssh and tar to transfer files from server to server. tar -cf – “”/ | ssh “tar -xf – ” Note: The transferred files will inherit the ownership of the (remote) user used to perform the transfer.
Add Linux users to groups: gpasswd -a “username” “groupname” Simple.
Note: this method was developed for older CentOS / Redhat systems and is unlikely to be required now. Go to http://java.sun.com/ and download the JRE for your distribution. If your distro supports RPM packages, get the “Linux self extracting RPM” version. This will then create a .bin file, which you need to execute – ./.bin. […]
grep will find a specific string of text in a file, but awk gives you the ability to isolate a particular column of text. For example, we have a text file with the following content in a file called test.txt: This is a line of text demonstrating the use of awk. So, running the following […]
Anothe rmethod to perform a recursive find in Linux using xargs instead of -exec find -name ‘*.c’ | xargs ls “$1” – will give a directory listing of all files that end in .c Use find -iname for a case insensitive search.
How to use chmod in Linux. chmod u+ = assign user permissions chmod g+ = assign group permissions chmod a+ = assign all permissions Some examples: Command: chmod u+wrx testfile.txt Result: -rwx—— 1 root root 0 Feb 5 16:53 testfile.txt Command: chmod g+wrx testfile.txt Result: —-rwx— 1 root root 0 Feb 5 16:53 testfile.txt Command: […]
————————————————————————- HANDY ONE-LINERS FOR SED (Unix stream editor) Apr. 26, 2004 compiled by Eric Pement – pemente[at]northpark[dot]edu version 5.4 Latest version of this file is usually at: http://sed.sourceforge.net/sed1line.txt http://www.student.northpark.edu/pemente/sed/sed1line.txt This file is also available in Portuguese at: http://www.lrv.ufsc.br/wmaker/sed_ptBR.html FILE SPACING: # double space a file sed G # double space a file which already has […]
Postfix DEBUGGING 1.) If things are acting strangely here is a simple and quick first step that could save you a lot of time. * TO CHECK THE CURRENT CONFIGURATION: /usr/sbin/postfix check * validates the Postfix mail system configuration and will * warn about bad directory/file ownership or permissions, and * create missing directories. 2.) […]