Commands using awk (1,418)

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

Bash autocomplete case insensitive search
Change bash autocomplete case search to insensitive when pressing tab for completion.

Compare two directory trees.
This uses Bash's "process substitution" feature to compare (using diff) the output of two different process pipelines.

Show all usernames and passwords for Plesk email addresses

List all symbolic links in current directory
With this version, you can list all symlinks in the current directory (no subdirectories), and have it list both the link and the target.

Explanation of system and MySQL error codes
perror should be installed if mysql-server package is installed

simple backup with rsync
With this cron, rsync begins to sinchronize the contents of the local directory on /[VIPdirectory] with the directory /backup/[VIPdirectory] on the remote server X.X.X.X. Previously we need working on public/private-keys ssh to guarantee the acces to the remote server on X.X.X.X

recursive reset file/dir perms
Good for fixing web permissions. You might also want to do something like this and skip files or directories that begin with a period: $ find public_html/stuff -not -name ".*" \( -type d -exec chmod 755 {} + -o -type f -exec chmod 644 {} + \) ...or include a special case for scripts: $ find public_html/stuff -type d -exec chmod 755 {} + -or -type f -name "*.pl" -exec chmod 755 {} + -or -exec chmod 644 {} +

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

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"

Replace all backward slashes with forward slashes
Use -i to edit file directly: sed -i 's|\\|\/|g' file


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: