What are the functional differences between .profile .bash_profile and .bashrc

.bash_profile and .bashrc are specific to bash, whereas .profile is read by many shells in the absence of their own shell-specific config files. (.profile was used by the original Bourne shell.) .bash_profile or .profile is read by login shells, along with .bashrc; subshells read only .bashrc. (Between job control and modern windowing systems, .bashrc by … Read more

Showing total progress in rsync: is it possible?

There is now an official way to do this in rsync (version 3.1.0 protocol version 31, tested with Ubuntu Trusty 14.04). #> ./rsync -a –info=progress2 /usr . 305,002,533 80% 65.69MB/s 0:00:01 xfr#1653, ir-chk=1593/3594) I tried with my /usr folder because I wanted this feature for transferring whole filesystems, and /usr seemed to be a good … Read more

Why is my crontab not working, and how can I troubleshoot it?

How to fix all of your crontab related woes/problems (Linux) This is a community wiki, if you notice anything incorrect with this answer or have additional information then please edit it. First, basic terminology: cron(8) is the daemon that executes scheduled commands. crontab(1) is the program used to modify user crontab(5) files. crontab(5) is a … Read more

What permissions should my website files/folders have on a Linux webserver?

When deciding what permissions to use, you need to know exactly who your users are and what they need. A webserver interacts with two types of user. Authenticated users have a user account on the server and can be provided with specific privileges. This usually includes system administrators, developers, and service accounts. They usually make … Read more

Anyone else experiencing high rates of Linux server crashes during a leap second day?

This is caused by a livelock when ntpd calls adjtimex(2) to tell the kernel to insert a leap second. See lkml posting http://lkml.indiana.edu/hypermail/linux/kernel/1203.1/04598.html Red Hat should also be updating their KB article as well. https://access.redhat.com/knowledge/articles/15145 UPDATE: Red Hat has a second KB article just for this issue here: https://access.redhat.com/knowledge/solutions/154713 – the previous article is for … Read more

How to run a server on port 80 as a normal user on Linux?

Short answer: you can’t. Ports below 1024 can be opened only by root. As per comment – well, you can, using CAP_NET_BIND_SERVICE, but that approach, applied to java bin will make any java program to be run with this setting, which is undesirable, if not a security risk. The long answer: you can redirect connections … Read more

Can scp copy directories recursively?

Yup, use -r: scp -rp sourcedirectory user@dest:/path -r means recursive -p preserves modification times, access times, and modes from the original file. Note: This creates the sourcedirectory inside /path thus the files will be in /path/sourcedirectory

How can I sort du -h output by size

As of GNU coreutils 7.5 released in August 2009, sort allows a -h parameter, which allows numeric suffixes of the kind produced by du -h: du -hs * | sort -h If you are using a sort that does not support -h, you can install GNU Coreutils. E.g. on an older Mac OS X: brew … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)