Basic Operations#
clash for windows: Github Release
After downloading, unzip and run ./cfw
in the current directory.
However, this requires repeating the step every time the computer is started, which is a bit inconvenient, and a terminal window will always be displayed after startup.
Screen Background Operations#
Syntax
screen [-AmRvx -ls -wipe][-d ][-h ][-r ][-s ][-S ]
Parameter description:
-A adjust the size of all windows to the current terminal size.
-d detach the specified screen session.
-h specify the number of lines in the window's scrollback buffer.
-m force the creation of a new screen session, even if one is already running.
-r resume a detached screen session.
-R attempt to resume a detached session. If no detached session exists, create a new one.
-s specify the shell to be executed when a new window is created.
-S specify the name of the screen session.
-v display version information.
-x attach to a previously detached screen session.
-ls or --list display all currently active screen sessions.
-wipe check all screen sessions and remove those that are no longer accessible.
Simple demonstration:#
screen -S screenname
This will create a screen named screenname. You can then close the terminal or use Ctrl+d to detach it. If you enter exit, the screen will be terminated directly.
`screen -ls`
List all currently active screens.
Note: If there are no running programs in the created screen, it will be automatically released after suspension.
"6160, 5945" can be considered equivalent to "test, clash".
Attached means it is already open in another terminal window,
Detached means it is not open.
Actual Operation#
Now let's write a script to start a new screen and run it in the background.
screen_name="clash"
screen -dmS $screen_name
cmd="sh /home/seele/Documents/clash.sh"
screen -X -S $screen_name -p 0 -X stuff "$cmd"
screen -x -S $screen_name -p 0 -X stuff '\r'
"\r" is used to input a carriage return. Otherwise, screen will only input the previous line without executing it. If combined into one line, it will only add a line break to the previous line without running it.
clash.sh is the script to start clash, as follows:
cd /home/seele/Documents/'Clash for Windows-0.18.1-x64-linux'/ && ./cfw
Finally, by setting an alias or running the screen.sh script at startup, clash can be started more conveniently.
Note:#
This method is not considered a simple operation when clash needs to be restarted multiple times, as the clash screen in screen does not automatically close. In the end, Appimage is still the best way to handle this type of software. Looking forward to official support.