Jump to content

What are some time-saving tips that every Linux user should know?


Recommended Posts

Posted

tar -zcvf - some_directory | ssh some_user@some_host 'cat > some_destination_file_path.tgz'

 

Tars, compresses, and copies a directory across servers in one step.

There are a number of variations on this command set, I use this one to illustrate the power of SSH since I think it's reasonably straightforward for less-experienced users to understand and adapt to their needs.

 

Rsync can do it even better, but this forms an encrypted tunnel.

Posted (edited)

Tip 01 Incrementally searchable bash history

 

create (or edit) your ~/.inputrc

 

"\e[A": history-search-backward
"\e[b": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

 

edit ~/.bashrc and bump up your command history retention.

export HISTSIZE=1000000
export HISTFILESIZE=1000000000

 

Upon reloading the console session, you can start typing, hit the up arrow key and incrementally search your command history.

 

Tip 02 Need to give someone quick access to a file on a local network?

 

python -m SimpleHTTPServer

will serve the current directory tree at http://HOSTNAME:8000

 

Tip 03 Human readable top-level space usage

 

alias du -h --max-depth=1 to "duh"

 

Tip 04 Logging what you did to make 'X' work

 

script whatidid.log

 

Logs all commands typed to whatidid.log. Use Ctrl +D to end

 

Tip 05 (For herding larg-ish amounts of servers)

 

Use something like Puppet (Puppet Labs: The Leading Open Source Data Center Automation Solution) and SVN (or rcs of choice) to make it easy to provision servers and maintain configs.

 

Edit: Look here too http://www.commandlinefu.com/commands/browse BUT be aware there's some daft things posted occasionally so work out what a command does before you use it in production.

Edited by pete
  • Thanks 2
Posted

If you administer any Linux systems I really recommend Unix and Linux System Administration Handbook: Amazon.co.uk: Evi Nemeth, Garth Snyder, Trent R. Hein, Ben Whaley: Books

 

This book approaches system administration in a practical way and is an invaluable reference for both new administrators and experienced professionals. It details best practices for every facet of system administration, including storage management, network design and administration, email, web hosting, scripting, software configuration management, performance analysis, Windows interoperability, virtualization, DNS, security, management of IT service organizations, and much more. UNIX® and Linux® System Administration Handbook, Fourth Edition, reflects the current versions of these operating systems:

 

Ubuntu® Linux

openSUSE® Linux

Red Hat® Enterprise Linux®

Oracle America® Solaris™ (formerly Sun Solaris)

HP HP-UX®

IBM AIX®

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...