Fundamental Unix Commands

From DreamHost
Jump to: navigation, search

The following are some basic commands which may be useful in the Unix/Linux shell.

To learn how to use them effectively, take a look at LinuxCommand.org.

id

print real and effective UIDs and GIDs for user’s terminal

who

displays a list of users currently logged on to the system

date

print the system date and time

passwd

update a user’s authentication token(s); change password

echo

displays a line of text

write

send a message to another specified user

mesg [ y : n ]

mesg – controls write access to your terminal by others

pwd

print name of current/working directory

ls

list directory contents

find

search for files in a directory hierarchy

mkdir

make directories

rmdir

remove empty directories

file

determine file type

cat

concatenate files and print on the standard output (usually screen)

more

file filter for paging through text one full screen at a time

man

formats and displays the on-line manual pages

tail

display the last few lines of a file

head

display the first few lines of a file

cp

copy files and directories

mv

move (rename) files

ln

make links between files

rm

remove files or directories

chmod

change file access permissions

touch

change file timestamps

chown

change file owner and group

chgrp

change group ownership

su

run a shell with substitute user and group IDs; switch user

newgrp

log in to a new group

vi

VI Text Editor

whereis

locate the binary, source, and manual page files for a command

sort

sort lines of text files

grep

print lines matching a given pattern

wc

print the number of bytes, words, and lines in files

> - redirection symbol

create a new file or overwrite an existing file by attaching it to a command that produces output.

>>

used to append output to an existing file without overwriting that file

cut

remove sections from each line of file

tr

translate or delete characters

tee

read from standard input and write to standard output and files

pr

convert text files for printing

ps

report process status

nohup

run a command immune to hang-ups, with output to a non-TTY

nice

run a program with modified scheduling priority

kill

terminate a process

tar

the GNU version of the tar archiving utility

cpio

copy files to and from archives

ftp

user interface to the standard File Transfer Protocol

telnet

used to communicate with another host using the TELNET protocol

rlogin

starts a terminal session on a remote host host

hostname

show or set the system’s host name

rlp

remote file copy

clear – And Ctrl + L

clear the terminal screen

sleep

delay for a specified amount of time

cal

displays a default or specified calendar

pg

page to control screen scrolling

diff

find differences between two files


See Also