-
Notifications
You must be signed in to change notification settings - Fork 4
Short 1
You connect to the training server using the username and password provided.
- See: Connecting via SSH (how to)
⚠️ Remember that you will not see the password as you type. If you fail logging in as for help and do not try again.
Use whoami
to check the username you are using in the remote server. Use pwd
to check the full path of your current working directory, that when you log in will be your home.
Type ls -l
to list the files present in your current directory. You can specify a different directory, for example ls -l /etc
, and even use wildcards like ls -l /etc/*.conf
. The last command will print only the files ending by .conf.
From your home directory (
git clone https://github.com/telatin/learn_bash
Now create a directory called course in your home. If you moved you can return to your home simply typing cd
, without any other argument.
mkdir course
You can alternatively use the full path, like mkdir ~/course
(knowing that ~ is the shortcut for your full path to your home)
First, let's move to the course directory:
cd course
Now, we can list the files in the downloaded folder, using a relative path (remember that "." represents the current directory, while ".." represents the upper level directory):
ls -l ../learn_bash/
A powerful command is find, that will scan all files and directories present in a path, recursing within subdirectories.
To print all files present in our home:
find ~
To print all directories present in our ~/learn_bash directory:
find ~/learn_bash -type d
To print all files ending by "fna":
find ~/learn_bash -type f -name "*.fna"
To copy one or more files we have the cp command. A simple test can be (can you rewrite it using relative paths?):
cp ~/learn_bash/phage/vir_genomic.fna ~/course
Again, we can use wild cards. Adding the -v
switch will give us live feedback of the process:
cp -v ~/learn_bash/misc/test/*.csv ~/course/
The detailed explanation of the use of every command is given by man (manual). It is an interactive program that allows to scroll and search in the text. Its use is the same for the less command we'll use later.
man cp
When launching the manual, you'll enter an interactive page. You can:
-
Scroll using the arrow keys, or “
Page Up
” and “Page down
”, or thespace bar
to scroll down one page -
g
will go quickly to the beginning of the document,G
to the end -
/
enable a serch inside the document: type “/”, a string and then ENTER -
After a search
n
will jump to the next occurrence,N
to the previous -
Finally,
q
to quit -
See also: More information on the filesystem
-
See also: First steps (extended)
· Bioinformatics at the Command Line - Andrea Telatin, 2017-2020
Menu