combines mkdir and cd added quotes around $_, thanx to flatcap! Show Sample Output
file displays a files type the -L flag means follow sym-links (as libraries are often sym-linked to another this behavior is likely preferred) more complex behavior (*two* grep commands!) could be used to determine if the file is or is not a shared library.
For those days when you need to know if something is happening because the day ends in "y". Show Sample Output
The same thing using only Bash built-in's. For readability I've kept the variables out, but it could me made extremely more compact (and totally unreadable!) by stuffing everything inside the single echo command.
no need for seq or eval
For those files in current folder that would be shown in `ls *ext`, for some extension ext, move/rename that file removing the .ext suffix from the file name. It uses Bash's parameter substitution, as seen in http://tldp.org/LDP/abs/html/parameter-substitution.html#PCTPATREF (for analog use in prefix, see http://tldp.org/LDP/abs/html/parameter-substitution.html#PSOREX2 )
Will move in that case every file in the current folder older than 30 days to the "old" folder Replace "mv $i old/" by any command such as rm / echo to do something different.
After a command is run in bash, !$ is set to the last (space-delimited) argument of the command. Great for running several commands against the same file in a row.
how to finish command or script without any output Show Sample Output
With counter format [001, 002, ..., 999] , nice with pictures or wallpapers collections.
the last person who posted used the most roundabout way to concatinate files, there's a reason there's a "conCATinate" command... Using this method, you also get to choose the order of the files, below another person just did *.txt > combined.txt which is fine but the order depends on the implementation of "cat" which is probably alphabetical order of filenames. Show Sample Output
Writes out the shebang line (#!/bin/bash) to the script.
many have aliases like: alias ...="cd ../../" alias ....="cd ../../../" and so furth. ..() mitigates to need for those aliases, see sample output for an example # .. -> go up 1 directory # .. 4 -> go up 4 directories ..() { local DIR='' declare -i NUM=0 if [[ ${1} =~ ^[1-9][0-9]*$ ]] then while (( ${NUM} < ${1:-1} )) do DIR="${DIR}../" NUM=$(( ${NUM} + 1 )) done else DIR=.. fi cd "${DIR}" } Show Sample Output
Credit goes to "eightmillion" Show Sample Output
Add an alias to your .bashrc that allows you to issue the command xkcd to view (with gwenview) the newest xkcd comic... I know there are thousands of them out there but this one is at least replete with installer and also uses a more concise syntax... plus, gwenview shows you the downloading progress as it downloads the comic and gives you a more full featured viewing experience.
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.
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
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: