Home > Command & Utility

Posts in Command & Utility

Tar: extract one or more files from an archive

February 22, 2010 Posted in Command & Utility

To extract a single file from an archive:
# tar zxvf tarfile.tgz –include=”desiredfile”

Use patterns:
# tar zxvf tarfile.tgz –include=”desiredfile*”

‘desiredfile’ must use full path. To check file’s fullpath:

# tar tf tarfile.tgz

SSH Copy

January 19, 2009 Posted in Command & Utility

Copy a local file to remote host with ssh port 123

# scp -P 123 /backup/localefile username@remotehost.com:/backup/

Copy file from remote host

# scp -P 123 username@remotehost.com:/backup/remotefile /backup/

vi Commands

October 31, 2008 Posted in Command & Utility

Condensed version for my own reference, only those commands I didn’t use but will make life easier. Read More

Terminal Control Character

October 27, 2008 Posted in Command & Utility

Some useful terminal control characters:

Ctrl-C Terminate current process.
Ctrl-U Erase current input line.
Ctrl-S Stop output for easy read.
Ctrl-Q Resume output after stop.
Ctrl-Z Suspend process. use fg command to restart.
Read More

Portsnap

April 20, 2006 Posted in Command & Utility

Portsnap is another tool for updating Ports tree, compared to CVSup, it’s more secure, faster and easier to use. You should give it a shot, especially when you build a new server.

Update ports tree
# portsnap fetch update

For complete guide, check out the handbook “Using Portsnap“.

Exclude a Sub-directory in Tar Command

August 27, 2005 Posted in Command & Utility

To backup the directory /home/ to file /backups/home.tgz, and exclude /home/apachelog/ : Read More

Keep Accurate Time with ntpd and ntpdate

July 30, 2005 Posted in Command & Utility

Obviously, keeping the server time accurate is very important. I should have done this before the server was public.

Adjust server time manually
# ntpdate pool.ntp.org Read More

Tar Command

April 12, 2005 Posted in Command & Utility

Tar can detect an archive with gz compression and extract the files properly, I used to call gunzip first :-(. Read More

Screen Command

November 6, 2004 Posted in Command & Utility

My Windows XP suddenly crashed when I was running a long-time Linux script, then I tried to find a way to regain the lost output, but it seems not possible, during the search on Google, I found a very useful Linux command: Read More

Cron Job

November 3, 2004 Posted in Command & Utility

Cron job is a very convenient tool in Linux, there are lots of information if you search “cron job” on Google. Read More



Categories

Archives

Links

  • Dedicated Servers
  • Meta