-
Notifications
You must be signed in to change notification settings - Fork 0
2. Basic linux commands
Type the command passwd. You will be asked once for your existing password and twice for the new one. There are some checks that you won't choose a too simple
one.
-
lsshows you all files and directories in the current directory -
ls -lshows additional information like size and last modification time -
cd <directory>dive into the directory -
cd ..goes one directory up -
cd ~brings you back into your home -
pwdshows you the current directory -
cp <source> <target>copies a file -
cp -R <source> <target>copies an entire structure -
mv <source> <target>moves or renames a file -
rm <file>removes a file -
mkdir <directory>creates a new directory -
rmdir <directory>removes an emtpy directory -
rm -Rf <directory>removes a directory including it's content -
less <file>look into a file, type q to leave less -
tail -f <file>follow a logfile, type C to quit -
vi <file>edit a file -
man <command>shows the manual page of the specific command
<file> and <directory> may be replaced by wildcards or partial names with wildcards. Use a * to say all files and directories in this directory or use for example R*.txt which will match all filenames starting with R and ending on .txt, for example Readme.txt as well as README.txt but not readme.txt. Useful for rm, but also really dangerous.
Your Home directory is abbreviated with a ~.
For cp and mv the target could be just a name, a full path or a dot which means in the current directory. Some examples:
-
cp this therecopy the file this in the current directory in a new file -
mv this thererenames the file to the new name -
cp this /scratch/therecopy a file to a different place -
cp /scratch/this .copy a file from a different directory to the current one -
cp /scratch/* .copy all files from a different directory to here
Another very useful feature of the Linux command line is tab-completion. If you start typing a command you can press the Tab key on your keyboard to automatically complete the command you wanted to write. If what you have typed so far is not enough to identify a single command, you can press Tab twice to see a list of possible options. This is especially useful when you have to type long filenames for example. If you want to delete My_File-With-a-longAndHardTo_RememberName.txt you could type rm My_File and press the Tab key to complete the long filename. If there is another file, let's say My_File-from-before.txt the filename won't complete on the first press of Tab, you will have
to press Tab a second time and so you can see the two options. Now simply type a few more letters before you hit Tab again to complete the filename.
UNINE - CCFS wiki pages