You are on page 1of 1

Unix/Linux Command Reference I

ile c o m mc n d s vstem lnfo

Is Directory listing date show the current date and time

Is -al Formatted listing with hidden files cal show this month's calendar

cddir Change directory to dir uptime show current uptime

cd Change to home w display who is online

pwd Show current directory whoami who you are logged in as

mkdirdir Create a directory dir finger user display information about user

rm file Delete file uname-a show kernel information

rm -rdir Delete directory dir cat /proc /cpuinfo cpu information

rm -f file Force remove fire cat /proc /meminfo memory information

rm -rf dir For remove directory dir man command show the manual for command

cp file) file2 Copy file l to file2 df show disk usage

cp -r dir1 dir2 Copy dirl to dir2; create dir2 if it d o e s n ' t exit du show directory space usage

mv file) file2 Rename or move file l to file2. 11 filed 2 is an free show memory and swap usage

existing directory, moves file l into directory file2 whereis app show possible locations of app

In -s file link Create symbolic link link to file which app show which app will be run by default

touch file Create or update file

c a t > file Places standard i n p u t into file

more file Output the contents of file

head file Output the firest l O lines of file Compression


tail file Output the last l O lines of file

tail-f file Output the contents of file as it grows,


tar et file. tar files create a t a r named file.tar containing files
starting with the last l O lines
tar xf file. tar extract the files from file.tar

tar czf file. tar. gz files create a tar with Gzip compression

tar xzf file. tar. gz extract a tar using Gzip

tar cjf file.tar.bz2 create a tar with Bzip2 compression

tar xjf file. tar. bz2 extract a tar using Bzip2

gzipfile compresses file and renames it to file.gz


ps display ali currently active processes
gzip -d file.gz decompresses file.gz back to file
top display ali running processes

killpid kili process id pid

killa/1 proc kili ali processes named proc *

bg lists stopped or background jobs; resume a


I Network
stopped job in the background

fg Brings the most recent job to the foreground

fg a brings job a to the foreground


ping host ping host and output results

whois domain get whois information for domain

dig domain get DNS information for domain

dig-x host reverse lookup host


¡1e Perrnissions
wget file download file

w g e t - c file continue a stopped download

chmod octal file change the permissions of file to octal,

which can be found separately for user,

group, and world by a d d i n g : nstolkrtion


• 4 - r e a d (r)

• 2 - write (w)

• l - execute (x) Insta// from source:

Examples:

chmod 777 - read, write, execute foral/ ./configure

chmod 755 - rwx for owner, rx for group and


make

world. For more options, see man chmod.


make install

install a package (Debían)


dpkg -i pkg.deb

install a package (RPM)


rpm -Uvh pkg.rpm

I SSH I

connect to host as user


ssh user@host
connect to host on port port as user
I shortcuts
ssh -p port user@host
add your key to host tor user to
ssh-copy-id user@host
enable a keyed or passwordless login
Ctrl+C halts the current command

Ctrl+Z stops the current command, resume with fg in the

foreground or bg in the background

I Seorehinq Ctrl+D log out of current session, similar to exit

Ctrl+W erases one word in the current line

grep pattern files search for pottern in files . . Ctrl+U erases the whole line

grep -r pattern dir search recurslvelv for pattern m dir Ctrl+R type to bring up a recent command

command I grep pattern search for pattern in the output of command !! repeats the last command

locate file find ali instances of file


exit log out of current session

* use with extreme caution

You might also like