Commands tagged version (12)

  • Works for most distributions, tested on Ubuntu, Fedora, CentOS, Gentoo, SUSE, RedHat. Debian and Slackware: cat /etc/*version Show Sample Output


    11
    cat /etc/*-release
    sudopeople · 2009-02-26 08:22:01 6
  • Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted. Inspired by the excellent EVACopy http://evacopy.sourceforge.net Show Sample Output


    5
    backup() { source=$1 ; rsync --relative --force --ignore-errors --no-perms --chmod=ugo=rwX --delete --backup --backup-dir=$(date +%Y%m%d-%H%M%S)_Backup --whole-file -a -v $source/ ~/Backup ; } ; backup /source_folder_to_backup
    pascalv · 2018-08-02 21:27:29 0
  • This command will give you the detailed information about the installed perl modules i.e. installed path, Link type, version, files etc. Show Sample Output


    3
    perldoc perllocal
    octopus · 2010-04-14 10:57:56 1

  • 2
    sw_vers
    theoj · 2009-08-29 21:27:18 0
  • If you use new features of a certain Bash version in your shell script, make sure that it actually runs with the required version.


    1
    if [ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]; then echo "This script requires Bash version >= 4"; exit 1; fi
    hfs · 2011-02-25 11:02:47 0
  • This is for Debian, simply change the path if your Flash plugin is installed elsewhere. Show Sample Output


    1
    strings /usr/lib/flashplugin-nonfree/libflashplayer.so |grep ^LNX
    domicius · 2012-04-25 10:34:57 0

  • 0
    nslookup -q=txt -class=CHAOS version.bind NS.PHX5.NEARLYFREESPEECH.NET
    unixmonkey4063 · 2009-06-02 19:54:24 1
  • Useful if you have multiple versions of Java installed. The 1.7 pkg for Mac doesn't tell you anything about where it's putting stuff. Show Sample Output


    0
    export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
    robinsonaarond · 2015-07-30 18:50:51 0
  • Cleaner than the top alternative Show Sample Output


    0
    test `uname` = Linux && lsb_release -a 2>/dev/null || ( test `uname` = SunOS && cat /etc/release || uname -rms )
    amhhhhhhh · 2017-04-25 13:35:40 0

  • 0
    & 'C:\cwRsync_5.5.0_x86_Free\bin\rsync.exe' --force --ignore-errors --no-perms --chmod=ugo=rwX --checksum --delete --backup --backup-dir="_EVAC/$(Get-Date -Format "yyyy-MM-dd-HH-mm-ss")" --whole-file -a -v "//MyServer/MyFolder" "/cygdrive/c/Backup"
    pascalv · 2020-03-06 10:17:42 16

  • -4
    lsb_release -d
    tebeka · 2009-05-07 16:19:04 6
  • Found in comments section works on most Linux flavors. Show Sample Output


    -8
    test `uname` = Linux && lsb_release -a || ( test `uname` = SunOS && cat /etc/release || uname -rms )
    virtualshock · 2009-07-07 20:51:30 0

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

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" }

copy/mkdir and automatically create parent directories
The --parents option will cause cp or mkdir to automatically create the parent directory structure. $mkdir --parents /one/two/three/dir will create /one, /one/two, and /one/two/three as needed before creating dir. cp will copy files with their full directory structure into the target directory with this option. Thanks to Peter Leung at: http://linuxcommando.blogspot.com/2007/11/use-of-parents-flag-in-mkdir-and-c.html which has good examples of usage.

find out how much space are occuipied by files smaller than 1024K
The command gives size of all files smaller than 1024k, this information, together with disk usage, can help determin file system parameter (e.g. block size) or storage device (e.g. SSD v.s. HDD). Note if you use awk instead of "cut| dc", you easily breach maximum allowed number of records in awk.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Generic shell function for modifying files in-place
Some commands (such as sed and perl) have options to support in-place editing of files, but many commands do not. This shell function enables any command to change files in place. See the sample output for many examples. The function uses plain sh syntax and works with any POSIX shell or derivative, including zsh and bash.

Quick access to ASCII code of a key

Show errors in the kernel ring buffer
Much more useful then parsing syslog

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Rename files in batch

Find usb device in realtime
Using this command you can track a moment when usb device was attached.


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: