| | |
Quick Reference for Linux Commands
![]() |
Handy Linux User Commands
../ represents one directory higher
cat filename display file contents
cat stuff1 stuff2 > allStuff combine files
cat someStuff >> allStuff append to a file
cd dirName go into the directory dirName
chmod [permission mode] file change the permission of a file (4=read, 2=write, 1=execute for user/group/all)
chown user file change the owner of a file
clear clear the terminal
cp file1 file2 copy file1 to file2
date print current date and time
find someStuff locate a file or directory
finger user get some info about a user
free display some stats about memory usage
ftp hostname connect to an ftp server
gunzip file.gz extract contents of gzipped compressed files
hostname display the hostname of the computer
kill [ID] terminate a process
less file view file in terminal with ability to scroll up and down
ln sourceName destDirectory create symbolic link to a file
locate file locate a file from a database maintained by the computer
login login to the computer
lpr file sends a file to the print spooler
ls list the contents of the current directory
ls directory list the contents of a given directory
man program display manual pages for a program
mkdir directory create a directory
more file view file in terminal with ability to scroll down
mv source target move a file
passwd user change a user's password
pico file open a file in the pico text editor
pwd print the full pathname of the current directory
quota user display the disk quota allocated to a user
rm file delete a file
rmdir directory delete a directory
rm -rf anything forcefully delete something (like a directory, recursively)
sh the standard Unix shell, bash
ssh hostname open an ssh session
su switch to the superuser's (root's) identity
su user switch to another user's identity
tail file print the last 10 lines of a file
telnet hostname open a telnet session
touch file update the access time and last modified time for a file to the current time and date
uname -a print system information
vi file open a file in the vi or vim text editor
who am i gives info about the current user
who -uH gives info and idle times for all users
Handy Linux Sys Admin Commands
halt shuts down the machine
mount /mnt/floppy mounts the floppy fs
mount /mnt/cdrom mounts the cd-rom fs
shutdown -r "now" restarts the machine
umount mountedLocation unmounts a filesystem
update db update file database used by locate command
../ represents one directory higher
cat filename display file contents
cat stuff1 stuff2 > allStuff combine files
cat someStuff >> allStuff append to a file
cd dirName go into the directory dirName
chmod [permission mode] file change the permission of a file (4=read, 2=write, 1=execute for user/group/all)
chown user file change the owner of a file
clear clear the terminal
cp file1 file2 copy file1 to file2
date print current date and time
find someStuff locate a file or directory
finger user get some info about a user
free display some stats about memory usage
ftp hostname connect to an ftp server
gunzip file.gz extract contents of gzipped compressed files
hostname display the hostname of the computer
kill [ID] terminate a process
less file view file in terminal with ability to scroll up and down
ln sourceName destDirectory create symbolic link to a file
locate file locate a file from a database maintained by the computer
login login to the computer
lpr file sends a file to the print spooler
ls list the contents of the current directory
ls directory list the contents of a given directory
man program display manual pages for a program
mkdir directory create a directory
more file view file in terminal with ability to scroll down
mv source target move a file
passwd user change a user's password
pico file open a file in the pico text editor
pwd print the full pathname of the current directory
quota user display the disk quota allocated to a user
rm file delete a file
rmdir directory delete a directory
rm -rf anything forcefully delete something (like a directory, recursively)
sh the standard Unix shell, bash
ssh hostname open an ssh session
su switch to the superuser's (root's) identity
su user switch to another user's identity
tail file print the last 10 lines of a file
telnet hostname open a telnet session
touch file update the access time and last modified time for a file to the current time and date
uname -a print system information
vi file open a file in the vi or vim text editor
who am i gives info about the current user
who -uH gives info and idle times for all users
Handy Linux Sys Admin Commands
halt shuts down the machine
mount /mnt/floppy mounts the floppy fs
mount /mnt/cdrom mounts the cd-rom fs
shutdown -r "now" restarts the machine
umount mountedLocation unmounts a filesystem
update db update file database used by locate command
Last edited by cscgal; Mar 16th, 2006 at 11:58 am.
A few minor corrections:
ln -s source destination (the -s switch denotes a symbolic link)
sh is the standard UNIX shell.
bash is the Bourne Again SHell, standard on most Linux systems. UNIX doesn't come with bash, unless it's installed seperately.
Handy Linux Sys Admin Commands
mount /mnt/floppy mounts the floppy device (if /mnt/floppy is the mountpoint)
mount /mnt/cdrom mounts the CD-ROM device (if /mnt/cdrom is the mountpoint)
shutdown -r now (no quotes)
or even reboot on some systems
updatedb or /usr/libexec/locate.updatedb
Should be:
ln sourceName destDirectory create symbolic link to a file
ln -s source destination (the -s switch denotes a symbolic link)
Should be:
sh the standard Unix shell, bash
sh is the standard UNIX shell.
bash is the Bourne Again SHell, standard on most Linux systems. UNIX doesn't come with bash, unless it's installed seperately.
Handy Linux Sys Admin Commands
Should be:
mount /mnt/floppy mounts the floppy fs
mount /mnt/floppy mounts the floppy device (if /mnt/floppy is the mountpoint)
Should be:
mount /mnt/cdrom mounts the cd-rom fs
mount /mnt/cdrom mounts the CD-ROM device (if /mnt/cdrom is the mountpoint)
Should be:
shutdown -r "now" restarts the machine
shutdown -r now (no quotes)
or even reboot on some systems
Can also be:
update db update file database used by locate command
updatedb or /usr/libexec/locate.updatedb
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
Sorry I've been away for awhile - work followed by a sunny vacation in Florida, doncha know...
I'll be posting a bunch of stuff next week after I get caught up at the office. Some howto's, cheat sheets, walkthroughs, etc.
If anyone has any requests, drop me a line, and I'll see what I can crank out for you.
I'll be posting a bunch of stuff next week after I get caught up at the office. Some howto's, cheat sheets, walkthroughs, etc.
If anyone has any requests, drop me a line, and I'll see what I can crank out for you.
If you spend more on coffee than on IT security, you will be hacked.
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
What's more, you deserve to be hacked.
-- former White House cybersecurity czar Richard Clarke
wc -l <file> counts the number of lines in a file
wc -w <file> counts the numbers of words in a file
wc -c <file> counts the number of bytes in a file
wc -m <file> counts the number of characters in file
You can combine with other commands ie:
ls | wc -l will count the number of files in the current directory.
cat /etc/passwd | wc -l will count the number of entries in /etc/passwd
wc -w <file> counts the numbers of words in a file
wc -c <file> counts the number of bytes in a file
wc -m <file> counts the number of characters in file
You can combine with other commands ie:
ls | wc -l will count the number of files in the current directory.
cat /etc/passwd | wc -l will count the number of entries in /etc/passwd
Application development, webhosting, and much more: www.webcentric-hosting.com
sometimes you have to specify how to mount a device as well...for instance...I have a second hard disk that is /dev/hdc
In order for me to use it, I have to mount it. In which case I would do the following:
>mount -t reiserfs /dev/hdc /mnt/share.drive (or whatever you want to mount it to in your File sys)
I use reiserfs for my storage drives since I store mostly mp3s, videos, and pics...so sub whatever you'd use in for it.
Also, you'd make changes to your /etc/fstab to automount that same mount you just did the next time you rebooted.
In order for me to use it, I have to mount it. In which case I would do the following:
>mount -t reiserfs /dev/hdc /mnt/share.drive (or whatever you want to mount it to in your File sys)
I use reiserfs for my storage drives since I store mostly mp3s, videos, and pics...so sub whatever you'd use in for it.
Also, you'd make changes to your /etc/fstab to automount that same mount you just did the next time you rebooted.
My Home Away from Home: Yet Another Linux Blog
another useful command that can be found is 'netstat' this can be used the same as on windows except with redhat, there are certain flags you can use.
ie.
netstat -a = shows all network traffic
netstat -an =shows all network traffic using numerical ips
netstat -anp = shows all network traffic using numerical ips and what programs they are associated with.
ie.
netstat -a = shows all network traffic
netstat -an =shows all network traffic using numerical ips
netstat -anp = shows all network traffic using numerical ips and what programs they are associated with.
•
•
Join Date: Jul 2004
Posts: 1
Reputation:
Solved Threads: 0
grep put in stout the line that has the spec word
ps check for all processes that are running
grep + ps in action
#ps aux| grep root
the stdout will be all line that got the wrd root instead
less helpfully command to format the output of a command, like the one above, this stout will be scrollable up/down
more like "less" but scrollable only down
ex.
ls /etc | less
[: sorry for my english :]
ps check for all processes that are running
grep + ps in action
#ps aux| grep root
the stdout will be all line that got the wrd root instead
less helpfully command to format the output of a command, like the one above, this stout will be scrollable up/down
more like "less" but scrollable only down
ex.
ls /etc | less
[: sorry for my english :]
Another handy one is sort
For example a script that shows disk usage per directory sorted largest first:
-k1nr tells sort to order the file on the first column, numerically, in reverse order
Tried to get it to work without the temp file but couldn't. For some reason sort refused to accept the output from du through a pipe (but maybe I did something wrong).
For example a script that shows disk usage per directory sorted largest first:
du $1 > /tmp/du.out sort -k1nr -odu.sort.out /tmp/du.out rm /tmp/du.out
-k1nr tells sort to order the file on the first column, numerically, in reverse order
Tried to get it to work without the temp file but couldn't. For some reason sort refused to accept the output from du through a pipe (but maybe I did something wrong).
![]() |
Other Threads in the Getting Started and Choosing a Distro Forum
- Previous Thread: Unix/Linux Links
- Next Thread: Linux Suse 10 Wireless
| Thread Tools | Search this Thread |
age-related baremetal chrome cio cloudcomputing code commercial computers crystalballsunday developers development distributions distro dsl elderly embedded google http://expertcore.org/ innovations jauntyjackalope kernel library linus linux microsoft multi-core netgear newbies openoffice.org operating operatingsystems parallel performance processing redhat routers smp studios system systembuilders systemintegrators terminalservices thecloud thinclients tools ubuntu users virtualization vmware webbased wikis windows xenon






