Shell
chapter 2
Shell
Installing tmux
tmux is a "terminal multiplexer", it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. tmux is intended to be a simple, modern, BSD-licensed alternative to programs such as GNU screen.
This release runs on OpenBSD, FreeBSD, NetBSD, Linux, OS X and Solaris.
tmux depends on libevent 2.x. Download it from:
use this command to install it:
Choose Shell
$ sudo apt-get install libevent-dev
It also depends on ncurses, available from:
http://invisible-island.net/ncurses/
to install ncurse open shell and type:
$ sudo apt-get install libncurses5-dev libncursesw5-dev
To build and install tmux from a release tarball, use:
$ ./configure && make
$ sudo make install
tmux can use the utempter library to update utmp(5), if it is installed - run configure with –enable-utempter to enable this.
To get and build the latest tmux from version control:
$ git clone https://github.com/tmux/tmux.git
$ cd tmux
$ sh autogen.sh
$ ./configure && make
to run sh autogen.sh
you need to install automake.
aclocal is part of the automake package.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install automake
To install tmux run the following command:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install tmux
To run tmux open shell and write:
tmux
see the tmux manual here tmux
and here tmux-cheatsheet
tmux for collaborative editing
Tested on MacOs Catalina with tmux version 3.2a and emacs version 27.2
Copy/paste the below code at the end of your ~/.emacs.d init file Code from EmacsWiki
(require 'server) ;; some systems don't auto-detect the socket dir, so specify it here and for the client: (setq server-socket-dir "/tmp/emacs-shared") (server-start)
;; highlight-changes-mode is very handy when collaborating: (global-highlight-changes-mode t) ;; Keys for moving back and forth between changes, set these to what ;; you prefer: (global-set-key (kbd "<f5>") 'highlight-changes-previous-change) (global-set-key (kbd "<f6>") 'highlight-changes-next-change) (global-set-key (kbd "<f7>") 'highlight-changes-rotate-faces) (global-set-key (kbd "<f8>") 'highlight-changes-remove-highlight)
Now you need to create a new user if you dont have one already. To do this go to System Preferences-> Users and Groups. Create the user (you can use the default user).
Then create a group and name it as you wish. I will name it users
for
the example. The group will have as members the host (user1) and the users with whom you collaborate with.
Now go and create a directory tmux-shared in tmp location. Open terminal and use the bellow commands to create the directory (mkdir) tmux-shared, change a group of the directory (chgrp) and change file permission (chmod).
$ mkdir /tmp/tmux-shared $ chgrp users /tmp/tmux-shared $ chmod g+ws /tmp/tmux-shared
Now its time to start the host using the below command:
Start up the host
$ tmux -S /tmp/tmux-shared/myshare
This will open tmux shell in /tmp/tmux-shared/myshare
directory.
start up emacs as host:
$ emacs
Now start the server:
on emacs do M-x:server-start
Now open a new shell tab (cmd-d on mac) and try to connect to the host. Connecting to the host
Connecting to the host
$ tmux -S /tmp/tmux-shared/myshare
then do
$ emacsclient --tty --socket-name /tmp/emacs-shared/server
Well done! Have fun.
Watch the example below:
Switch to zsh
The Z shell (zsh) is a Unix shell […]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh1
Installing zsh on Linux
Some Linux systems come preloaded with zsh. You can check if it exists as well as its version by writing zsh –version in a terminal window. In case this zsh version is ok for you, you're done now!
Determine on which Linux distribution your system is based on. See List of Linux distributions – Wikipedia for a list. Most Linux systems – including Ubuntu – are Debian-based.
Debian-based linux systems
Open a terminal window. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.
Choose Shell
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install zsh
You can use zsh now.
to switch from bash to zsh open shell and run the following command:
$ chsh -s $(which zsh)
To know which shell are you using, use the following command:
$ echo $SHELL
It will return something like:
/bin/bash
or
/bin/zsh
After you know the shell, if the file .bashrc or .zshrc doesn't exist in your home directory (echo $HOME to find out), just create it.
If you are using bash, you may have a file called .bash_profile where you can put your export command instead (don't know in zsh).
Convert w4a, mp4, etc to wav
Choose Shell
install ffmeg
$ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
link brew with python
brew link python
remove existed files
rm 'usr/local/Cellar/2to3'
convert .m4a to .wav
$ ffmpeg -i /Users/sounds/23.3.\ j.m4a 23.3.\ j.wav
convert all the files into directory with .wma to mp3
$ for file in *.wma; do ffmpeg -i "${file}" -acodec libmp3lame -ab 192k "${file/.wma/.mp3}"; done