Commands using cp (116)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

View acceptable client certificate CA names asked for during SSL renegotiations
The key is to use the -prexit option at the command line, and then type "quit" instead of CTRL-C to exit OpenSSL. OpenSSL will then dump its last negotiated state, printing out the contents of the renegotiated handshake. Crucial for debugging client certificate configurations on web servers such as IIS, which renegotiate the SSL/TLS connection with the HTTP request in-flight to ask the client for a cert.

Updated top ten memory utilizing processes (child/instance aggregation) now with percentages of total RAM
Prints the top 10 memory consuming processes (with children and instances aggregated) sorted by total RSS and calculates the percentage of total RAM each uses. Please note that since RSS can include shared libraries it is possible for the percentages to add up to more that the total amount of RAM, but this still gives you a pretty good idea. Also note that this does not work with the mawk version of awk, but it works fine with GNU Awk which is on most Linux systems. It also does not work on OS X.

Convert all MySQL tables and fields to UTF8
This loops through all tables and changes their collations to UTF8. You should backup beforehand though in case some data is lost in the process.

stderr in color
in case you run some command in CLI and would like to take read strerr little bit better, you can use the following command. It's also possible to grep it if necessary....

Find the date of the first commit in a git repository
Finds the date of the first commit in a git repository branch

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

convert unixtime to human-readable with awk
- convert unixtime to human-readable with awk - useful to read logfiles with unix-timestamps, f.e. squid-log: sudo tail -f /var/log/squid3/access.log | awk '{ print strftime("%c ", $1) $0; }

Bash scripts encryption and passphrase-protection
This function will encrypt a bash script and will only execute it after providing the passphrase. Requires mcrypt to be installed on the system.

tar and remove files which are older that 100 days
tar does not have a -mtime option as find. tar appends all the file to an existing tar file.

Realy remove file from your drive
This command remove a file from your filesystem like the normal rm command but instead of deleting only the inode information this also delete the data that was stored on blocks /!\ warning this may be long for large files


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: