Linux

See our training slides: Linux

To find command help:

command_name --help
man command_name

Examples:

blastall --help

man ls

cd : change directory
pwd : print working directory
ls [nom_répertoire]: list directory contents
tree : list contents in a tree like format
who : show who is logged on the server
history : display the commands history
mkdir[nom_répertoire]: create directory
rmdir [nom_répertoire]: remove empty directory
cp: copy file
mv: rename or move a file
rm: remove file

PATH is an environmental variable that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user.

To view the contents of PATH:

env | grep PATH

To add absolute path in PATH variable:

export PATH=/path_to/binaries:$PATH

To add it permanently absolute path, adding this export command in the file ~/.bashrc

Change owner, group and others permissions

Use chmod (more help here)

Examples:

$ chmod u+rw file1: gives the owner (u) write (r) and read (w) permissions to file1.
$ chmod -R a+rx folder1: gives all users (a) read (r) and execute (x) rights to all the folder1 content (-R Recursive).
$ chmod 755 folder1: gives the owner all rights (7), group members and others the rights to read and access (55).
$ chmod 644 file1: gives the owner the rights to modify and read (6), to the members of the group and the others only the rights of reading (44).


Add user and group on "home" and "save"

Use NFSv4 ACL (more help here).
To set permissions: nfs4_setfacl
To check permissions: nfs4_getfacl

Examples:

Add user1 with read (R) and execution (X) permissions to all the folder1 content (-R Recursive)

$ nfs4_setfacl -R -a A::user1:RX folder1

Add group1 (g) read (R) et execution (X) permissions to all the folder1 content (-R Recursive)

$ nfs4_setfacl -R -a A:g:group1:RX folder1

Check permissions

$ nfs4_getfacl folder1
A:g:group1@genopole.toulouse,o=inra,c=fr:rxtncy
A::user1@genopole.toulouse,o=inra,c=fr:rxtncy
A::OWNER@:rwaDdxtTnNcCoy
A::GROUP@:rxtncy
A::EVERYONE@:rxtncy

 

Add user and group on the "work"

Use ACL commands (more help here)
To set permissions: setfacl
To check permissions: getfacl

Examples:

Add (-m modify) user1 read (r),write (w) et execution (x) permissions to all the folder1 content (-R Recursive)
$ setfacl -R -m u:user1:rwx folder1

Add group1 (g) read (r) et execution (x) permissions to all the folder1 content (-R Recursive)
$ setfacl -m g:group1:rx folder1

Check permissions

$ getfacl folder1
# file: folder1
# owner: username
# group: username_g
user::rwx
user:user1:rwx
group::r-x
group:group1:r-x
mask::rwx
other::r-x

Your account allows you to have your own web pages in a directory called public_html.

1- Create public_html folder:
mkdir ~/save/public_html
ln -s ~/save/public_html ~/

2- Verify or fix permissions

/home/username et /save/username must be at least drwx--x--x
chmod 711 /home/username

Default permissions for public_html folder are drwxr-xr-x:

everyone can read and execute (upload for exemple) content.


To remove read access to the directory base: chmod o-r .
To make file or folder world readable: chmod o+r filename or foldername

3- Visualize web content
Open in browser: https://genoweb.toulouse.inra.fr/~username