Web Hosting Forums

Web Hosting

Discussion Forums

Useful shell commands for linux

This is a discussion on Useful shell commands for linux within the HowTo Tutorials for dedicated servers forums, part of the Dedicated Server Topics category; New dedicated server operators normally are overwhelmed by the added level of complexity compared to virtual hosting. There are so ...


Go Back   Web Hosting Forums > Dedicated Server Topics > HowTo Tutorials for dedicated servers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1  
Old 04-21-2007, 01:17 PM
michael_s's Avatar
AABox Staff
 
Join Date: Dec 2003
Posts: 89
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Default Useful shell commands for linux

New dedicated server operators normally are overwhelmed by the added level of complexity compared to virtual hosting. There are so many more things to configure, and so many more things that can go wrong. With that, you also have the resources to pretty much do whatever you need to do with your machine. So, below is a fairly large list of commands that you can issue from the shell.

Have a look to see what you can do, and maybe you will find that command that you need!

System Information

cat [opts] [filepattern] - Print file contents to screen
  • -E :Display a $ at the end of each line.
  • -T :Show tabs as ^I.
  • -v :Show non-printing characters.
date [opts] Print or set the system date and time
  • --date=STRING :display time described by STRING.
  • --set=STRING :set time described by STRING.
dmesg [opts] Print or control the kernel ring buffer
  • -c :Clear the contents of the ring buffer.
file [opts] [filepattern] Determine the file type
  • -z :Try to look inside compressed files.
finger [opts] [userpattern] Show info about system users
  • -m :Match the exact username specified.
free [opts] Display free and used memory in the system
  • -b :Display the information in bytes.
hexdump [opts] Show all the characters of a file
  • -c :Display the input offset in hexidecimal
last[opts] [username] Show last system logins for users
  • -num :Show last num of sessions.
  • -a :Display the hostname in the last column.
  • -d :Translates IP numbers to their hostname.
  • -f <file> :Use file as last log.
less [opts] [filepattern] View a file a page at a time
  • -i :Do case insensitive searching.
  • -S :Don’t wrap long lines.
man [opts] [section] <manpage>View online manual pages.
  • -a :View all available manual pages for name.
  • -k string :Search for the specified string.
md5sum [opts] [filepattern] Show the uniqueness of files

ps [opts] Show what processes are running on the system
  • a :Select all processes on a terminal.
  • u :Display user oriented format. More columns.
  • x :Select processes without a controlling TTY.
  • w :Show an extra line of process entry per w.
  • Ex: ps auxwww =Displays all process information on system.
quota [opts] [user] Display disk usage and limits
  • -v :Display filesystems where no quota is set.
time [opts] [command] Show resource usage for a command
top [opts] ·Display top CPU processes every X seconds
  • -d sec :Set the delay to sec seconds before refreshing.
umask [opts] [mode] Set the default file permissions
  • -S :Show current symbolic umask.
uname [opts] Show OS and kernel information
  • -a :Show everything
  • -r : Show current kernel version
uptime Show system uptime and load
w [opts] [user] ·Show who is logged in/what they are doing
whereis[command] ·Locate the related files for a command
which [command] ·Show full path to the specified command
who [opts] [args] ·Show who is logged in


File System Commands
cd [-] [directory] Change directory
  • - :Change to the previous directory you were in
chmod[opts] <mode> <filepattern> Change permissions
  • -R :Change permissions recursively
chown[-R] <user>[.group] <file> Change ownership
  • -R :Change ownership recursively
cp[opts] <from> <to> Copy files and directories
  • -i :Interactive mode. Prompt before overwriting
  • -p :Preserve file permissions and ownership
  • -R :Copy directories recursively
df[opts] [device name] Print filesystem usage info
  • -a :Show all filesystems.
  • -h :Human readable format. Quantify byte information.
  • -i :Show inode usage info.
du[opts] [pattern] Show space usage on files and dirs
  • -c :Produce a grand total for all arguments.
  • -h :Human readable format. Quantify byte information.
  • -s :Summarize. Only show a total for each argument.
  • -S :Do not include size of subdirectories.
find<path> [-name ‘pattern'] Search for a file.
  • find /home –name ‘index.html’ –perms –644 -ls
gzip[opts] <filepattern> Compress a file or files
  • -1..9 : Set compression level. 9=highest, 1=lowest.
  • -d :Decompress file. Same as the gunzip command.
  • -l :List the statistics for a compressed file.
ln[opts] <tofile> <linkfile> Create a sym/hard link
  • -s :Create a symbolic link between files. (alias name)
  • -f :Force creation, even if the link file exists.
ls[opts] [pattern] List file and directory entries
  • -a :List all files including . and ..
  • -d :List directories themselves, not their contents.
  • -l :Long list. Shows permissions and modified time.
  • -r :Recusively list files in directories.
  • -S :Sort output by file size.
  • -u :Sort by the last access time.
  • -X :Sort by filename extension.
  • -1 :Print output files one per line.
  • --time=atime :Show last access timestamp for file.
mkdir [opts] <dirname> Make a new directory
  • -m mode: Set the initial permissions to mode.
  • -p :Create parent directories if they don’t exist.
mv[-i] <frompattern> <tofile> Move/Rename a file
  • -i :Interactive move. Prompt before moving files.
rm[opts] <filepattern> Remove a file
  • -f :Force removal. Don’t ask if it’s ok to remove.
  • -i :Interactive remove. Prompt before each file.
  • -r :Recusively delete directories an their contents.
tar[opts] [tarfile] [pattern] Create an archive
  • -c :Create mode. Create a tar archive.
  • -x :Extract mode. Untar archive contents.
  • -t :List mode. List the contents of the archive.
  • -f :Specify a tarfile to use.
  • -v :Verbose mode. Show files being added or untared.
  • -z :Compress. Filter input/output through gzip.
touch[opts] <pattern> Update the timestamp on a file
  • -a :Only change the access time on the file.
  • -t :Specify a timestamp to use instead of current time
__________________
Michael Sasek
AABox Staff
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

« - | - »

LinkBacks (?)
LinkBack to this Thread: http://forums.aabox.com/howto-tutorials-dedicated-servers/90-useful-shell-commands-linux.html

Posted By For Type Date
Pages tagged with This thread Refback 06-04-2007 12:56 PM
StumbleUpon » michael-s's web site reviews and blog This thread Refback 04-22-2007 06:35 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -8. The time now is 07:49 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright ©2002-2008 AABox Web Hosting