Basic UNIX commands

Basic UNIX commands

Unix is a portable, multitasking, multiuser, time-sharing operating system (OS).The Unix operating system is a set of programs that act as a link between the computer and the user.UNIX is case-sensitive.

Basic Commands:


ls

Lists your files.

ls -l

Lists your files in ‘long format’, which contains lots of useful information. The information will be the exact size of the file, owner of the file and who has the right to look at it, and the last modified date.

ls -a

Lists all files, including the ones whose filenames begin in a dot, which you do not always want to see. There are many more options, for example to list files by size, by date, recursively etc.

emacs filename

Is an editor that lets you create and edit a file.

mv filename1 filename2

moves a file into a different directory.

cp filename1 filename2

copies a file

rm filename

removes a file.

diff filename1 filename2

compares files, and shows where they differ

wc filename

You will find how many lines, words, and characters there are in a file

chmod options filename

It will allow you to change the read, write, and execute permissions on your files.

gzip filename

This command compresses files so that they take up much less space.

gunzip filename

uncompresses files compressed by gzip.

Directories Directories, like folders on a Macintosh, are used to group files together in a hierarchical structure.

mkdir dirname

Create a new directory

cd dirname

change directory.

pwd

tells you where you currently are.

whoami

Returns your username.

passwd

Lets you change your password.

kill PID

kill the processes with the ID you entered. If you don’t know the process ID just type ps and you will get I’d

quota -v

Get details information regarding your disk quota.

du filename

Get the disk usage of the files and directories in filename.

date

Shows the current date and time.

cal

Shows a calendar of the current month.

Leave a Comment