Unix Command List for Beginners.txt - Notepad

Unix Command List for Beginners

Hello and welcome to Beare's Unix Command List for Beginners. This page describes basic and useful Unix commands in layman's terms.

ls

Lists the contents of a file.

pwd

Stands for Print Written Directory. Prints the name of the working directory eg /home/folder

whoami

Prints the username of the user currently logged on.

who

Displays a list of users who are currently logged on.

cd

Stands for Change Directory. Used to change the current working directory. eg cd /home/folder1

cat

Displays the contents of a file eg cat test.txt

touch

Used to create a new empty file eg touch newfile

cp

Copies a directory or file.

df

Abbreviation for Disk Free. Shows the amount of used/free space for filesystems. Useful command to see how much space is left on your hard drive.

free

Displays memory usage - total, free, used.

uptime

Displays how long the server has been on for. Also displays the number of users who logged on and the average CPU load for the past 1, 5 and 15 min intervals.

ifconfig

Used to setup a network interface card. Allows you to configure the ip address, netmask and default gateway. The command uses the following convention:
ifconfig (interface) (ip address) netmask (netmask ip) up/down
For example, the following command applies an ip address and netmask to the ethernet 0 interface and turns it on (up): ifconfig etho0 192.168.1.5 netmask 255.255.255.0 up

banner

Outputs a larger version of whatever you type eg banner hello world!

wall

Displays a message to all logged on users. Useful for root sending a message to all users advising of a system shutdown. Type wall and press enter. Now type your message followed by enter and ctrl-d.

echo

Outputs text to the screen eg echo Hello world!

uname

Stands for Unix Name. Displays details such as the name and version of your computer and Operating System. Try running uname -a for an extended output.

top

Produces a list of top-resource consuming processes ordered by CPU usage. Also displays current CPU utilisation.

htop

Similar to top expect it displays a full list of process running, not just the top-resource consuming processes. It's also in colour.

ps

Short for Process Status. Similar to top, displays all running processes.

kill

Used to end a process. Eg to close a process with an ID of 1234 type kill 1234.

pkill

Can kill a process based on name rather than PID, eg pkill firefox.

motd

Stands for Message of the Day. The contents of the file /etc/motd are displayed upon logon. You can edit the motd using a text editor like vi.