Published on 04 Mar 2020 in Computer Science

Linux, the data scientist's best friend

Some simple commands

The exact format of the date and time as printed by date varies from one system to another, but it displays what the system thinks is the current date and time (because it can be changed by the super-user).

$ date
mercredi 4 mars 2020, 23:13:50 (UTC+0100)

Another simple one-word command tells you who is using the system.

$ who
me     :1           2020-03-04 20:54 (:1)

A variation of the who command is whoami. Used to find out who opened the current terminal or session.

The passwd command changes passwords for user accounts. A normal user may only change the password for his/her own account, while the superuser may change the password for any account. passwd also changes the account or associated password validity period.

$ passwd

The rm (remove files) command is:

$ rm [-fri] file ...
  • -f ignore nonexistent files and arguments, never prompt
  • -i prompt before every removal
  • -r remove directories and their contents recursively

The pwd command is a request to print the working directory.

$ pwd
/home/me

The ls command is a request to the system to list the contents of a directory. If no directory is specified on the ls command line, you get a list of files in the current directory, which is the one you are working in.

$ ls [-al]

The -a (for all) option to ls asks that all files (even hiffen) and subdirectories are listed. The -l (for long) option asks for a long listing; without it only the names of the files and subdirectories are shown. The period character “.” (usually called “dot”) means the current directory. The two periods “..” means the parent directory.

You are the owner of your own “home” directory, you are not necessarily the owner of the parent directory. The slash character , /, is called the root of the file system.

$ ls -l dir1 dir2

The ls command above requests a long display of the two directories dir1 and dir2. This form of ls places the name of each directory before the information for its subdirectories.