Linux Command Exercises
Linux Command Exercises
a) name
#uname
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?
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.
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.
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?
Without changing from the directory /home/user1, create indir1another directory that is called
tmp.
List only the names of files and subdirectories in the directory/binlet them begin
for the letterm (detail what happened)
#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
Find all files and directories that are older than 30 days
antiquity
find / -atime +30 -print
#exit or #logout
CTRL-ALT-DEL
halt
#shutdown–h now
#shutdown–r now
Log out of the system using some of the learned commands. What command
used?