0% found this document useful (0 votes)
43 views5 pages

Linux Command Exercises

The document outlines a basic workshop on Linux commands aimed at familiarizing users with the Linux operating system. It covers essential commands for navigating the file system, managing files and directories, and using the terminal. The workshop includes practical exercises and commands for displaying system information, creating and deleting files, and logging out of the system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views5 pages

Linux Command Exercises

The document outlines a basic workshop on Linux commands aimed at familiarizing users with the Linux operating system. It covers essential commands for navigating the file system, managing files and directories, and using the terminal. The workshop includes practical exercises and commands for displaying system information, creating and deleting files, and logging out of the system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CENTER FOR AERONAUTICAL SCIENCES STUDIES

Basic Workshop on Linux Commands


Ing. Ricardo Benavides
Objectives of the Exercise.

Familiarization with the LINUX system as a user, learning to use the


most common commands.

• Handle basic orders to display information on the screen, users, manage


directories and files.

Learn to navigate the file system.

1.2 Linux Console


Press CTRL-ALT-F1 to go to a virtual console. Do the same but with F2.
F3, F4, F5, and F6. What has happened?

Return to graphical mode with CTRL-ALT-F7.

1.3 Visualization of your identifier


A) Visualize the name.
#who am I
b) Which users are currently connected to the system?
#who
1.4 Visualize the following information about the system.

a) name
#uname

b) operating system version (release date to the public)


#uname -v

c) hardware that supports it.


#uname -a
1.5 Dates:

a) Visualize the current date and time.


#date
b) Visualize the complete calendar of the year.
#cal 2009

c) Check the day of the week of your birthday in the year 2006.
#calendar 11 2008
CENTER FOR AERONAUTICAL SCIENCES STUDIES
Basic Linux Commands Workshop
Ing. Ricardo Benavides
What happens if you only type in the command line cal...?

1.6 Familiarize yourself with the online manual (man man). Choose a specific section for something
that is in several sections. For example, do man uname, man cal, and man pwd. To exit
from the manual just press the q key... this will enable the command line again...

What did you observe on the screen when writing and executing the man commands along with cal?
What is your current directory and username?

File and directory management

Determine in which directory you are with pwd and navigate through the directories with cd
directory, looking at what files are in them and what type they are. Visit /etc, /dev, /bin,
/usr/bin, /sbin, etc.

3.1 To obtain the absolute path to the current directory


#pwd

What result did you get? What appeared on the screen?

3.2 To move around the environment


#cd /etc (type this and press enter... )

What result did you obtain?

Change to the /devcon directory using the corresponding command.

What specific command is used to successfully change to the dev directory?

To go to our working directory (the working directory is the root directory of the
user -account- that you are using
#cd <enter>

3.3 Examine what files or directories are in the current directory with ls, ls -l, ls -
a, # ls -F, etc.

What is observed when using ls -r and ls -q?

From the home directory (run the command pwd and you will see that you are in the
home directory of your user account) see all files and directories of the
root directory that includes the letter l in its name. Also, from home, see the
CENTER FOR AERONAUTICAL SCIENCES STUDIES
Basic Linux Commands Workshop
Ing. Ricardo Benavides
list of files and directories located in/usr/binin whose name it may be present
the letter l. Let's see (write:):#cd #ls *l*

#ls -d *l (with the -d option it prevents the contents from being displayed
directories)
list files in /usr/bin starting with l
# ls -l (shows the contents of the current directory without the
details of each item to be displayed
#ls–la (shows information in long format, including files
hidden)
We are asked to list the content of the grandparent directory in chronological order.
our home directory.#ls -l ../.. (observe the chronological order)#ls
See that the chronological order is from newest to oldest
ancient
What information does the following command show us?
# ls -F | more
(the character | is on the key of 1 or on the key next to 1, above the
tab key... press the Alt key located to the right of the bar
spacebar, in conjunction with the key that has the character | or ¦...when the
command execute, press the space bar to continue the
data deployment, or enter to display an additional element
each time
# ls–R | more
What is the difference between this command and the previous one?

3.4 Create the directoriesdir1ydir2/home/user1 directory.

mkdir dir1 dir2

Without changing from the directory /home/user1, create indir1another directory that is called
tmp.

From the directory/tmp:

View the contents of the current directory.


ls

View the contents of the directory/bin.


ls /bin

List only the names of files and subdirectories in the directory/binlet them begin
for the letterm (detail what happened)

list contents of /bin that start with m


CENTER FOR AERONAUTICAL SCIENCES STUDIES
Basic Linux Commands Workshop
Eng. Ricardo Benavides

Check if from the directory/usrhang another directory calledpubIf so,


determine the date of its creation.

Return to the previous directory


#cd..
Change to a specific directory (absolute path)
#cd /etc
to return to the working directory
#cd <Enter>

3.5 Copy files or directories

Create a blank file

#create temp1
Copy an old file to a new one
copy temp1 temp2
copy a file to another directory
cp temp1 /tmp
copy temp1 to dir2
cp temp1 dir1/new
cp /home/user1/dir1/new /tmp/new1
What do the following commands do?
#cp /etc/termcap ../ #cp /etc/shells /home/user1/
#cp /etc/termcap ../

3.6

Change the name of a file


#mv temp2 practice
Move the file to another directory
#mv practice dir1
3.7

Delete the files


#rm temp1 temp2 is the same as writing rm temp*
delete directory
#rm–r dir1
#rmdir dir2
3.8

To search for specific information in a directory


to display all files and directories on the disk, it would suffice with:
#find / -print (to interrupt the command response, press the Esc key)
CENTER FOR AERONAUTICAL SCIENCES STUDIES
Basic Linux Commands Workshop
Ing. Ricardo Benavides
If only files or only directories are desired:
#find / -type f -print

Find all files and directories that are older than 30 days
antiquity
find / -atime +30 -print

4. Salir del Sistema y sesión

4.1 To end a session

#exit or #logout

4.2 Log out of the system

CTRL-ALT-DEL

halt

If we execute the following commands, what happens?

#shutdown–h now

#shutdown–r now
Log out of the system using some of the learned commands. What command
used?

What screen appeared after executing that command?

You might also like