What I learned: Part 1 Linux commands

Note: the "What I learned" series of posts is intended as a reference.

Problem 1: starting a long running process process on a GNU/Linux (Ubuntu) machine without having to keep your session open

If you find yourself working regularly on a the same GNU/Linux server but your session doesn't stay alive then there is one command that is really helpful:
tmux
The short flow for using tmux is:
  1. ssh into the remote machine
  2. start tmux by typing tmux into the shell
  3. start the process you want inside the started tmux session
  4. leave/detach the tmux session by typing Ctrl-B and then D or close your ssh session
Whenever you want to continue working in your tmux session you can just do this with
tmux attach
Some useful tmux commands:
Ctrl+b d         detach
Ctrl+b %         split window vertically
Ctrl+b "         split window horizontally
Ctrl+b x         kill pane
Ctrl+b arrow     navigate between panes
For more information on tmux:
http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course
http://askubuntu.com/a/220880

tmux

Problem 2: Viewing the lists of processes and their memory usage

top
top

Problem 3: Displaying the user rights of a directory

ls -la "directory_name"
ls

Problem 4: copy a file from Windows to a GNU/Linux box with ssh

pscp /path/to/your/file.txt username@example.com:/path/on/server
pscp can be downloaded at the same place as the ssh tool putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.
pscp

Conclusion

A lot can be done with the built-in linux tools or some downloads but you have to know they exist or where to look for them. A very good introduction to GNU/Linux and its wonderful world of commands is A Practical Guide to Linux Commands, Editors, and Shell Programming.

No comments: