###### tags: `Sys.management` # résumé commande --- https://www.linux.org/threads/more-useful-commands.4131/ --- make a file looks like it was done the 07 mai at 09h15 Code: touch -t 05070915 my_report.txt touch [a file name] to find a file by name Code: find -name *hawaii You may have created some file recently. For example, you may want to find some file that you were working on, let's say from now up to 10 minutes ago, you could type. Code: find -mmin +0 -mmin -10 Create a file with 'pico' or any Linux text editor, create a file called 'mary1.txt' Code: pico mary1.txt Let's explain this a little. 'grep' looks for the word "Mary" in any text file that is called "mary(something).txt". You've created three files that start with 'mary', so the asterisk makes sure that 'grep' will look for the word 'Mary' in all three. Code: grep Mary mary*.txt 'who' is a command to find out who's working on your system. As you now know, Linux is a multi-user system. Even if you're using one computer at your home, you may be working as more than one person. For example, if you logged in as 'root' but are working as 'bob'. who tee' is used to write out what appears on your screen into a file. You will be using this with the after a pipe '|' . You might do this: Code: ls -l | tee directory_listing to get a file with the listing of a directory. If you've placed files in a directory to be backed up, you could use this command to create a listing of that directory. You could print out the file on a label and stick it to the disk, tape, zip cartridge or whatever you used to make the backups. If you're using the 'tee' command for the backups I described before, you may want to put a date on the file. You can use this command: Code: date | tee -a directory_listing The command 'date' will enter the date and time in the file at the end. Remember to use the -a option if you're going to write to that file a second time. If you don't you will erase everything on the file in favor of whatever the second command was. The '>' command The "greater than" symbol '>' will do the same as 'tee'. You don't need the pipe command (|) with this one. Code: ls -l > directory_listing will give you the same result. If you want to add the date at the end, use the command: Code: date >> directory_listing with two "greater than" symbols (>>) The two symbols will add to the file without erasing its contents (appending). whatis To show you how to use the 'whatis' command 'whatis' is a command so you can find out what a program does. If you explore your Linux system, you will find a lot of programs and you may not know what they do. You would simply type: Code: whatis grep whereis whereis is a nice command for finding other commands or programs. If you decide to download any program from the internet, that program may need other programs in order to work. If you want to know whether or not you have it, you can type: whereis [program name] and find out. If you wanted to find out if you have the 'pico' editor and where it is, you would type: Code: whereis pico which To show you another tool for locating programs 'which' is similar to 'whereis'. It will give you the location of a program. At times, a program may not find another program it needs to make it run. It will need to know its location or "path". For example, a program may need Java to run it but thinks its in another place. You would simply type: Code: which java echo To show you some uses of the 'echo' command 'echo' is a little command that repeats anything you type. For example if you type Code: echo hello Linux will display the word 'hello' . There is a practical use for 'echo' in everyday life. I sometimes use it to write short notes. If we use 'echo' along with 'pipe' (|) and 'tee', you've got a poor-man's post-it-note. For example: Code: echo remember to tell Bill Gates he owes me 5 bucks | tee -a bill_gates.note Will make you a nice reminder note about dear 'ole Bill. Just remember to read your note. You could type: Code: echo remember to open Gates note | tee -a remember_gates.note to make yourself a reminder for the other reminder note. Use less bill_gates.note or less remember_gates.note to read your notes wc Actually, this command will give you the number of lines, words and letters (characters) in a file and in that order. Let's go back to the file about the people I owe money. If I type: Code: wc people_I_owe_money.note I will get this output: 439 6510 197120 wc people_I_owe.note As you can see, there are 439 lines, so that means if each line represents one person, then I owe 439 people money. There are 6510 words and a total of 197120 characters.