Linux Command Exercises
Linux Command Exercises
3.- List all files in the etc directory that start with t in reverse order.
ls -r /etc/t*
4.- List all the files in the dev directory that start with tty and have 5 characters.
ls /dev/tty??
5.- List all files in the dev directory that start with tty and end with 1, 2, 3, or 4.
list /dev/tty*[1-4]
6.- List all the files in the dev directory that begin with t and end with C1.
ls /dev/t*c1
7.- List all files, including hidden ones, from the root directory.
ls -a /
8.- List all files in the etc directory that do not start with t.
list directories in /etc that do not start with 't'
9.- List all files in the usr directory and its subdirectories.
Invalid input. Please provide a text to translate.
pwd
date
cd /home
15.- List all the files in the HOME directory showing their inode number.
ls -i
16.- Delete all visible files and directories from your TEST directory.
rm -rf PRUEBA/*
17.- Create the directories dir1, dir2, and dir3 in the PRUEBA directory. Inside dir1 create the
directory dir11. Inside the directory dir3 create the directory dir31. Inside the directory dir31,
create the directories dir311 and dir312.
mkdir TEST/dir1
mkdir TEST/dir1/dir11
mkdir TEST/dir2
mkdir TEST/dir3
mkdir TEST/dir3/dir31
mkdir TEST/dir3/dir31/dir311
mkdir TEST/dir3/dir31/dir312
18.- Copy the file /etc/motd to a file named message in your PRUEBA directory.
19.- Copy the files from the rc.d directory located in /etc to the dir31 directory.
cp -r /etc/rc.d dir31
20.- Copy to the directory dir311 the files from /bin that have an 'a' as the second letter and their
name has four letters.
cp -r /bin/?a?? TEST/dir3/dir31/dir311
21.- Move the directory dir31 and its subdirectories under dir2.
22.-Display on screen the ordinary files of the HOME directory and its subdirectories.
ls -R $HOME
23.-Delete the files and directories from dir1, including the directory itself.
rm -rf TEST/dir1
24.- Delete the files from dir312 that do not end in b and have a q as the fourth letter.
rm -r PRUEBA/dir2/dir31/dir312/???q[^b]
25.-Move the directory dir312 under dir3.
26. - Navigate to dir3 and create the new directory new1 inside dir1.
27.-Copy the files that start with u from the /bin directory to the new1 directory.
cp -r /bin/u* enlacedir1/nuevo1/
rm fich1
29.- Position yourself in dir1 and copy the file fichl into dir311.
cat enlafich1
32.- Create the directories dir2 and dir3 in the directory TEST. What are the current permissions of the
directory dir2?
34.- Using octal notation, remove the read permission from the directory dir2 for the rest of the
users.
ls -l
ls -l dir2
38.- Change the current directory to the dir3 directory. Print its full path for
check the change.
cd .. cd dir3 ls -lR
ls -lR
reboot
41.- Create four new directories called dira, dirb, dirc, and dird under the current directory.
42.-Check the access permissions of the newly created directories to verify the
functioning of the umask command.
ls -l
43.-Create the file one. Remove all read permissions. Check it. Try to delete it.
said file.
create one chmod a-r one ls -l remove one
The directory folder1 with three permissions for the owner, inside it file1 with read and
writing for all and fich2 with read and write for the owner and read only for the
restaurant.
The directory folder2 with all permissions for the owner and read and execute for others.
from the same group. Within file1 with read and write permissions for the owner and the group and file2
with the same permissions for the owner and read-only for the group.
create folder1 set permissions u=rwx,g=,o= folder1 create file folder1/file1 create file folder1/file2 set permissions =
folder1/file1 chmod = folder1/file2 chmod o=rw folder1/file1 ls -l
create directory folder2 change permissions user=read-write-execute, group=read-execute, others= folder2 create file folder2/file1 create file folder2/file2 change permissions =
45.-Create two directories called mail and sources under the current directory.
create directory mail create directory sources
46.- Position yourself in the sources directory and create the directories dir1, dir2, dir3.
cd $HOME
49.- View the permissions for the files in the /dev directory.
ls -l /dev
51.- Create the directory uno1 with all permissions for the user, none for the users
of the group and write permission for the rest of the users.
Change the permissions of the directory 'uno' so that the owner and group have read, write, and execute permissions, and others have no permissions. Create a directory 'uno1' inside 'uno'. Change the permissions of 'uno1' so that the owner has read, write, and execute permissions, the group has no permissions, and others have write permissions. List the details of the directory 'uno1'.
who
53.- Create the directory folder under the PRUEBA directory. Remove all permissions from it.
reading.
create directory folder change mode to remove read permission from folder find home directory -type directory > directory
54.- Display a complete list (search command ps) of the processes that are
performing as the root user.
ps -U root -u root u
55.- Find out what the current activity of the system is. To do this, view a complete list of
status of all processes that are running in the system.
top -d 1 -n 10
who -q