1. 1. Let's say you are standing in the /home/user/Documents directory.
Go to the /usr/share/common-licenses directory. Use both, the
absolute and the relative path.
cd /usr/share/common-licenses
cd ../../../usr/share/common-licenses
2. Suppose you are standing in the /usr/local/bin directory. Go to the
/usr/share/common-licenses directory. Use both, the absolute and the
relative path.
cd /usr/share/common-licenses
cd ../../share/common-licenses
3. Suppose you are standing in some directory. Go to your home
directory using both, absolute and relative path.
cd (goes to home directory)
cd
4. Create all possible two-character filenames with A and B symbols.
touch {A,B}{A,B}
Example with more characters (e.g. A, B, C):
bash
CopyEdit
touch {A,B,C}{A,B,C}
5. Create 10000 html extension files in the HTML directory. Do the
operation in the Shell with one command!
touch HTML/file{1..10000}.html
6. Create filenames "name1", "name2" and "name3" with and without
the "txt" file extension. Do the operation in the Shell with one
command!
touch name{1..3} name{1..3}.txt
7. Create filenames "name1", "name2" and "name3" with the "txt" file
extension. The file extension should be given in all character case
variants - uppercase, lowercase and mixed: txt, txT,… TXT. Do the
operation in the Shell with one command!
touch name{1..3}.{t,T}{x,X}{t,T}
8. Create filenames "name1", "name2" and "name3" with the "txt" file
extension. The file extension should be given in all character case
variants - uppercase, lowercase and mixed: txt, txT,… TXT. Do the
operation in the Shell with one command!
mkdir {a..z}{A..Z}{0..9}
9. Create directories of all possible two-character names with the
hexadecimal characters. Do the operation in the Shell with one
command!
mkdir {0..9,a..f}{0..9,a..f}
10. Suppose you have a lot of image files with jpg, bmp and png
extensions in the "Photos/" directory. Select the jpg and png files
containing at least one digit in the filename and whose first letter is
between D to P. Do the operation in the Shell with one command!
ls Photos/[D-P]*[0-9]*.jpg Photos/[D-P]*[0-9]*.png 2>/dev/null
11. Suppose you have a lot of image files with jpg, bmp and png
extensions in the "Photos/" directory. Select the jpg and png files (file
extension can be given in uppercase, lowercase, or mixed cases)
containing at least one digit in the filename and whose first letter is
between D to P. Do the operation in the Shell with one command!
ls Photos/[D-P]*[0-9]*.[jJ][pP][gG] Photos/[D-P]*[0-9]*.[pP][nN][gG]
2>/dev/null
12. Suppose you have a lot of video files with flv, vob and ogg
extensions in the "Videos/" directory. Select the flv and ogg files (file
extension can be given in uppercase, lowercase, or mixed cases)
containing at least one digit in the filename and whose last letter is
between K to Q. Do the operation in the Shell with one command!
ls Videos/*[K-Qk-q0-9]*[0-9]*.[fF][lL][vV] Videos/*[K-Qk-q0-9]*[0-9]*.[oO][gG]
[gG] 2>/dev/null
13. Suppose you have a filename toto containing another filename.
Display the content of the latter file on the screen. Do the operation
in the shell with and without a pipe.
cat toto | xargs cat
14. Suppose you have a filename foo in the bar/ directory containing
the full path to another filename. Display the size of the latter file on
the screen. Do the operation in the shell with and without a pipe.
cat bar/foo | xargs wc -c
15. Create a filename toto if no titi filename exists. Do not display an
error message on the screen.
[ ! -e titi ] && touch toto 2>/dev/null
16. Create a filename toto if the filename foobar exists, otherwise
create a filename titi. Do not display an error message on the screen.
[ -e foobar ] && touch toto 2>/dev/null || touch titi 2>/dev/null
17. Run the "ls -l" command on one terminal and display the output
on the other one.
ls -l | tee /dev/pts/1
tty ( am komandit vzebnit terminalis zust paths )
187. წაშალე toto ფაილის პირველი ხაზი.
188. წაშალე მესამე ხაზი.
189. წაშალე ბოლო ხაზი.
190. წაშალე მეხუთედან მეცხრე ხაზი.
191. დატოვე მხოლოდ მეხუთე ხაზი.
192. დატოვე მხოლოდ მეხუთედან მეცხრე ხაზები.
# 187
sed '1d' toto
# 188
sed '3d' toto
# 189
sed '$d' toto
# 190
sed '5,9d' toto
# 191
sed '5!d' toto
# 192
sed '5,9!d' toto
რომელი კვირის დღეიყო
date -d 2006-05-24 +%A